I think there's nothing wrong with my code, but the error message such as 'Please enter your name' does not appear on the screen when I submit the empty form. So...
1.Please help me figure out why the $ErrMsg does not appear on the screen.
2.If I want to join 2 conditions like if the $name and $surname is not empty, how to code it in PHP. I know that I have to use && but I can't write the correct structure.
3.Do I have to assign the new variable to keep the value when I have to use the variable as session_register?
Example: If the value in textbox is $name and I want to use it as session_register, do I have to assign $Newname= $name everytime?
Please....
Thank you so much! --> really mean it
========================================================
Here is my code:
$ErrMsg = ""; //initialized
if (!(empty($Submit)))
{ if (empty($Name))
$ErrMsg = $ErrMsg."Please enter your name. <BR>";
if (empty($Surname))
$ErrMsg = $ErrMsg."Please enter your surname. <BR>";
if ($ErrMsg == "") //If all textboxes are filled, assign the values.
{
$EnterName = $Name;
$EnterSurname = $Surname;
include("Form3.php");
exit;
}
else //print error
{
print $ErrMsg;
}
}