Hi,
I have a form validation and then the form.
<?php
if ( isset($_POST['submitted'])
{ if ($_POST[name])
{ $name = $_POST[name];
}
else
{ //what code goes here?
}
}
<form name="A.php" action="" method="post">
......
<input type="text" name="name" id="name" />
....
<input type="text" name="email" id="email" />
....
</form>
?>
What I would like to happen in the else statement is that if name field is left blank user is automatically redirected to the name field which should be highlighted and a small error message that the name field was left empty should appear. What would be the code for that? I would be very grateful for all help.
I have a form validation and then the form.
<?php
if ( isset($_POST['submitted'])
{ if ($_POST[name])
{ $name = $_POST[name];
}
else
{ //what code goes here?
}
}
<form name="A.php" action="" method="post">
......
<input type="text" name="name" id="name" />
....
<input type="text" name="email" id="email" />
....
</form>
?>
What I would like to happen in the else statement is that if name field is left blank user is automatically redirected to the name field which should be highlighted and a small error message that the name field was left empty should appear. What would be the code for that? I would be very grateful for all help.