Jump to content

Form validation with 2 actions if error or not


Eggzorcist

Recommended Posts

I'm wondering wether it's possible that if there is an error as in if $error isset, it will stay on this page displaying the error otherwise, it will go to the destined action='register.php' is this possible?

 

if so, how would i be doing this?

 

Thanks a bunch!

on your place onSubmit("return action();") on your <form>

and make a function named action() or any thing you want to name it dn make a if else condition for your validation if validation creates an error return false; and if no errors return true;

place onSubmit("return action();") on your <form>

and make a function named action() or any thing you want to name it dn make a if else condition for your validation if validation creates an error return false; and if no errors return true;

Well, is there a way to create a regex style validation? So basically if I already have

 

 if (!preg_match("/\A[^0-9][a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)*[@][a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)*[.][a-zA-Z]{2,4}$/", $email)){
	$Error .= "Email Address Must Be In format: [username]@[domain].[extension] <br />";
}

 

is there a javascript way of doing this? My javascript is pretty bad :P

Yes, I do. However, this needs to be in javascript to be able to use the onSubmit html function, because I'm trying to use the validation before the action which leads off to another file. Is there a way to implement the php regex prior the action(register.php) file?

 

 

Thanks

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.