Form submision probs with Javascript and PHP
| From: | Gobins, Debbie | Date: | Sat, 10 Feb 2001 01:01:06 +0000 |
| Subject: | Form submision probs with Javascript and PHP | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-39043@lists.php.net to get a copy of this message | ||
Pat,
Try using the escape char like this:
<input type=\"button\" name=\"submit\" value=\"Add User\"
onClick=\"submitForm(this.form, 'adduser-do.php')\"
style=\"width=150\">
****************************************************************************
********************
Here's my script. This is a known working script when I use ASP. Why won't
is wotj with PHP.
function submitForm(f, strPage) {
errormsg = "";
if (f.login.value.length == 0) {
errormsg = errormsg + "Please enter a login name.\n";
}
if (f.email.value.search("@") == -1 || f.email.value.search("[.*]") == -1)
{
errormsg = errormsg + "Please enter a valid email address.";
}
if (errormsg != ""){
alert(errormsg);
}
else {
f.action = strPage;
f.method = "post";
f.submit();
}
}
Here's the button.
<input type="button" name="submit" value="Add User"
onClick="submitForm(this.form, 'adduser-do.php')"
style="width=150;">
Any help would be great.
Thanks,
Pat