need help strange error on php form handling in PHP Posted February 10, 2014 · Edited February 10, 2014 by tommywij Hi, I'm newbie here. I need some help regarding form handling, here is my code <?php if($_SERVER['REQUEST_METHOD']=='POST') { if(isset($_POST['name'])) { $name = test_input($_POST['name']); $nameErr=validateName($name); } if(isset($_POST['email'])) { $email = test_input($_POST['email']); $emailErr=validateEmail($email); } if($nameErr="" and $emailErr="") { UpdateConfig(); } } ?> <form method="post" action="" style="margin-left:60px"> Name : <input type="text" name="name"> <span class="error">* <?php if($name!=""){echo $nameErr;} ?></span> <br> E-mail: <input type="text" name="email"> <span class="error">* <?php echo $emailErr;?></span> <br><br> <input type="submit" name="submit" value="Submit"> </form> My problem occur on the error message that echo within the class error, email error is showing but name error isn't. I've tried to echo both var nameErr and emailErr within the php bracket and it is showing nicely, but still it is not showing on line <span class="error">* <?php if($name!=""){echo $nameErr;} ?></span> this is kind of strange, any help is appreciated Thanks
need help strange error on php form handling
in PHP
Posted · Edited by tommywij
Hi, I'm newbie here.
I need some help regarding form handling, here is my code
My problem occur on the error message that echo within the class error, email error is showing but name error isn't.
I've tried to echo both var nameErr and emailErr within the php bracket and it is showing nicely, but still it is not showing on line
<span class="error">* <?php if($name!=""){echo $nameErr;} ?></span>
this is kind of strange, any help is appreciated
Thanks