PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Hi everyone, I have a registration script process_form.php which
processes the user inputs of the form in main.htm. But i run
this script and click on the submit button, i get an error which
says- "Invalid argument supplied for foreach() in
C:\wamp\www\test\process_form.php
Try using $_POST instead of $HTTP_POST_VARS, the latter is deprecated and may not work.
If that doesn't help, try var_dump($form_vars) in your filled_out function.
By the way, in that foreach loop, how could !isset($key) ever be true?
(Perhaps you intend to check for missing fields, i.e. !isset($form_vars['email']) etc?)
Hi apollo, I have an input form "register.php" which the user uses to register. Its action field is " do_register.php". I have included javascript alert functions in " do_register.php" to check the user inputs. When I provide wrong inputs and click on 'submit', I get the correct error message in alert boxes but i am directed to a different page whereas i want to stay on the "register.php" so that the user can fill the form again before being directed to the "members.php" page. Please tell me how to do this.
if (!valid_email($email))
{
print("<script language = 'javascript'>alert('Not a valid email address');</script>");
exit();
}
// passwords not same
if($passwd != $passwd2)
{
print("<script language = 'javascript'>alert('Passwords donot match');</script>");
exit();
}
// check password length is ok
// ok if username truncates, but passwords will get munged if they are too long.
if (strlen($passwd)<6 || strlen($passwd) >16)
{
print("<script language = 'javascript'>alert('Password must be between 6 to 16 characters');</script>");
exit();
}