Hai.. i already added javascript validation for my form.Its working fine.But mean while i ve to validate the same form using PHP also.
This is the form code:
class airportclass{
function add_airport_frm(){
$errmsg=0;
<table>
<form action="" method="post" name="airport" >
<tr> <td colspan="2" align="center"><?php echo $errmsg; ?></td></tr>
<tr>
<td><strong>Code :</strong></td>
<td><input type="text" name="code" id="code" /></td>
</tr>
<tr>
<td><strong>Name:</strong></td>
<td><input type="text" name="name" id="name" /></td>
</tr>
</form>
</table>
}
This is the PHP script in another file :
if(isset($_POST['postcode']) && $_POST['postcode']!="")
{
$code=$_POST['code'];
$name=$_POST['name'];
$postcode=$_POST['postcode'];
$auth=$_POST['auth'];
if(trim($code)=='')
{
$errmsg = 'Please enter code';
}
}
But its not working. Only javascript validation is working.PHP validation is not working.
Can any one suggest me????