here you go
<?php
error_reporting(0); // turn error messages off
$errors_array = array();
if(isset($_REQUEST["form_already_seen"])){
check_data();
if(count($errors_array != 0)){
show_errors();
show_form();
}
else{
handle_data();
}
}
else {
show_form();
}
function show_form()
{
$title = isset($_REQUEST["title"]) ? $_REQUEST["title"] : "";
$first_name = isset($_REQUEST["name"]) ? $_REQUEST["name"] : "";
$last_name = isset($_REQUEST["surname"]) ? $_REQUEST["surname"] : "";
$st_address = isset($_REQUEST["address"]) ? $_REQUEST["address"] : "";
$agee = isset($_REQUEST["age"]) ? $_REQUEST["age"] : "";
echo "<form Method='POST' ACTION='validation.php'>";
echo "<h3 align='center'>Register</h3>";
echo "<table width='250' border='2' align='center'>";
echo "<tr>";
echo "<td>Title :</td><td><input name='title' type='text' value'", $title, "' maxlength='4' /></td>";
echo "<tr>";
echo "<td>Name :</td><td><input name='name' type='text' value'", $name, "' maxlength='20' /></td>";
echo "</tr>";
echo "<tr>";
echo "<td>Surname :</td><td><input name='surname' type='text' value'", $surname, "' maxlenght='20' /></td>";
echo "</tr>";
echo "<tr>";
echo "<td>Address :</td><td><input name='address' type='text' value'", $address, "' maxlength ='50' /></td>";
echo "</tr>";
echo "<tr>";
echo "<td>Age :</td><td><input name='age' type='text' value'", $age, "' maxlength ='2' /></td>";
echo "</tr>";
echo "</table>";
echo "<p align='center'>";
echo "<input type='submit' name='validate' value='Validate' />";
echo "<input type='hidden' name='form_already_seen' value='already_seen' />";
echo "</p>";
echo "</form>";
}
function check_data()
{
global $errors_array;
if($_REQUEST["title"] == ""){
$errors_array[] = "<font color='red' align='center'>Please enter your Title</font>";
}
if($_REQUEST["name"] == ""){
$errors_array[] = "<font color='red'>Please enter your Name</font>";
}
if($_REQUEST["surname"] == ""){
$errors_array[] = "<font color='red'>Please enter your Surname</font>";
}
if($_REQUEST["address"] == ""){
$errors_array[] = "<font color='red'>Please enter your Address</font>";
}
if($_REQUEST["age"] == ""){
$errors_array[] = "<font color='red'>Please enter your Age</font>";
}
}
function show_errors()
{
global $errors_array;
foreach ($errors_array as $err){
echo $err, "<br>";
}
}
function handle_data()
{
echo "Thanks, all details inserted correctly!";
}
?>
Also this is more of an HTML issue but Im having trouble centering the table for the user input, the Heading Register and the Validate button are centered but my table still seems to go to the left even though I have this echo "<table width='250' border='2' align='center'>";