echo errors in wrong Place [SOLVED]
Posted: Mon May 07, 2012 10:57 am
So my problem is this, I got a registration form BUT every time I got an error it display it above the <h1> Registration </h1> title I have in my form. My goal is to place the errors Below the Registration title. I have a class called register and the function that display errors in it. This is the code;
function display_errors
Thank you in advance for future replies
Code: Select all
if(isset($_POST['submit']))
{
include_once('register.php');
$register = new Register();
if($register->process())
header("Location:http://www.google.com");
else
$error_mess = $register->display_errors();
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Registration</title>
<link rel="stylesheet" type="text/css" href="../style.css" />
<body>
<h1> Registration </h1>
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
</div>
<?php
if ($error_mess) { echo $error_mess ;}
?>
...The rest of the form HTML code...
Code: Select all
public function display_errors()
{
echo "<h3>Errors</h3>";
foreach($this->errors as $key=>$value)
echo $value."<br>";
}