Still new to PHP, trying to get around an error!
Scenario is pretty simple, i'm trying to do a sample form validation via php, this is the code,
<?php
if($_POST){
$t_name=trim($_POST["name"]);
$t_email=trim($_POST["email"]);
if($t_name==""){
$n_err=1;
}
elseif($t_email==""){
$e_err=1;
}
}
?>
then towards the form fields i do this,
<?php if($n_err)echo "Please enter correct name"."</br"; ?>
<?php if($e_err)echo "Please enter correct email"."</br>"; ?>
But this gives an error
As far i see you can use php vars defined in section on others, only var inside function are local in nature if they are not using "global" prefix. Please help me figure out why im getting this error, i know it might be something simple, so kindly help, thanks!