[RESOLVED] Form validating issues; form action to php file negates validation, why?
Iíve been trying to mesh tutorials and this is what Iíve come up with. However, my ďYour message has been sentĒ alert which I was trying to apply at the end (if everything was verified) never comes through and Iím absolutely stumped. Any pointers would be greatly appreciated.
Now my other issue is that when I attach the php file (below) to the form action (ie. action=Ēmyfile.phpĒ) Ė the form no longer even bothers to remotely try to validate. It just sends the contents straight through and I get my ďYour message has been sent messageĒ and this also confuses me. I thought checkform() needed to come back as true for the submit button to move the user forward.
if (document.contactAPC.name.value == '')
alert('Please enter a name.');
else if(document.contactAPC.email.value == '')
alert('Please enter an email address.');
else if(document.contactAPC.message.value == '')
alert('Please write a message.');
else if(document.contactAPC.email.value != '')
emailpattern = /^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9])+(\.[a-zA-Z0-9_-]+)+$/;
alert("Please enter a valid email address");
//Why can't I get this message to show?
alert("Your message has been sent.");
<form name="contactAPC" method="post" action="" onSubmit="return checkform()">
Name <input type="text" size="26" id="name" name="name" class="txtfield_details">
<br />Email <input type="text" size="26" id="email" name="email" class="txtfield_details">
<br /><textarea cols="24" rows="4" class="txtfield_details" name="message" id="message"></textarea>
<br /><input type="submit" value="Submit" name="submit" class="btns" />
<input type="reset" value="Clear" name="clear" class="btns" />
$email = $_REQUEST['email'] ;
mail( "firstname.lastname@example.org "From my Website",
$message, "From: $email" );
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread