Hi, I have created a PHP page that write down form data to mySQL table.
Before i submit data I want to check the Input field, whether it has filled up or Not.
the form should validate from the PHP itself Not from JS or any other client side scripting.
when i submit the form [page1.php] by using $PHP_SELF i can trap the errors, but it will delete previously entered values from the page and display empty input boxes.
So what i need to do I want display errors with the Incorrect values, we will say that i am checking the email id whether in the correct format or not.error should display in the header area of the page and incorrect value still should remain in the input box.
Can i do this by iframes. or is there any better way for this...
[PHP]
<?
//PHP Code Goes Here
?>
<html >
<head>
</head>
<body>
<p>Errors Should Display Here </p>
<form id="form1" name="form1" method="post" action="<?php echo $PHP_SELF; ?>">
<table width="315" border="0" cellspacing="0" cellpadding="0">
<tr>
<th width="69" scope="row"><div align="left">First Name<span class="style1">* </span></div></th>
<th width="144" scope="row"><div align="left">
<input name="fn" type="text" id="fn" />
</div></th>
</tr>
<tr>
<th scope="row"><div align="left">Last Name<span class="style1">* </span></div></th>
<th scope="row"><div align="left">
<input name="ln" type="text" id="ln" />
</div></th>
</tr>
<tr>
<th scope="row"><div align="left">email<span class="style1">*</span></div></th>
<th scope="row"><div align="left">
<input name="email" type="text" id="email" />
</div></th>
</tr>
<tr>
<th scope="row"><div align="left"></div></th>
<th scope="row"><div align="left"></div></th>
</tr>
<tr>
<th scope="row"><div align="left"></div></th>
<th scope="row"><div align="left">
<input type="submit" name="Submit" value="Submit" />
</div></th>
</tr>
</table>
</form>
</body>
</html>
[/PHP]