How To Add PHP Function as UDT?
Posted: Sat Nov 06, 2010 11:46 am
Hi,
I'm adding a form to a page like this:
So I want to include the checkForm function in the page so I have created a UDF called CheckForm and defined it like this:
function checkForm(RememberMeForm)
{
//For First Name
if (!(RememberMeForm.rem_firstname.value))
{
alert("Please enter a First Name")
RememberMeForm.rem_firstname.focus()
return false
}//End Of First Name
//For Surname
if (!(RememberMeForm.rem_surname.value))
{
alert("Please enter a Surname")
RememberMeForm.rem_surname.focus()
return false
}//End Of First Name
}//End Of Function
But when I submit this for saving I get this error message:
Invalid code entered.
Parse error: syntax error, unexpected ')', expecting '&' or T_VARIABLE in /home/www/arrivealivett.com/admin/adduserplugin.php(100) : eval()'d code on line 1
Basically, I want to validate the input on a form and then run a php script to update a database. What am I doing wrong here?
Thanks for any help
I'm adding a form to a page like this:
So I want to include the checkForm function in the page so I have created a UDF called CheckForm and defined it like this:
function checkForm(RememberMeForm)
{
//For First Name
if (!(RememberMeForm.rem_firstname.value))
{
alert("Please enter a First Name")
RememberMeForm.rem_firstname.focus()
return false
}//End Of First Name
//For Surname
if (!(RememberMeForm.rem_surname.value))
{
alert("Please enter a Surname")
RememberMeForm.rem_surname.focus()
return false
}//End Of First Name
}//End Of Function
But when I submit this for saving I get this error message:
Invalid code entered.
Parse error: syntax error, unexpected ')', expecting '&' or T_VARIABLE in /home/www/arrivealivett.com/admin/adduserplugin.php(100) : eval()'d code on line 1
Basically, I want to validate the input on a form and then run a php script to update a database. What am I doing wrong here?
Thanks for any help