denoteone Posted February 18, 2008 Share Posted February 18, 2008 I am using a javascript form validation that if is true will submit(); but for some reason my the java is not setting the submit so that the php will execute. here is the important parts of my code. <? echo " <html> <head> "; if(isset($_POST["Submit"])) { echo "you are in"; } <? }else{ ?> <form name="phpformmailer" action="<?=$PHP_SELF?>" method="POST"> <table class="request" width="100%" boder="0" cellpadding="0" cellspacing="0"> <tr> <td class="request" width="40%" height="28" style="text-align:left">Email<span class="style1">*</span></td> <td class="request" width="60%" height="28" style="text-align:left"> <input name="email" type="text" id="email" size=27 maxlength=80></td></tr> </table> <script language="JavaScript"><!-- function validateForm() { var okSoFar=true with (document.phpformmailer) { var foundAt = email.value.indexOf("@",0) if (foundAt < 1 && okSoFar) { okSoFar = false alert ("Please enter a valid email address.") email.focus() } if (okSoFar==true) { Submit(); } } } // --></script> <table class="request" width="100%" boder="0" cellpadding="0" cellspacing="0"> <tr><td class="request" width="70%" height="40" style="text-align: center"> <input type="button" class="button" value="Submit" name="B1" ONCLICK="javascript:validateForm()"> it worked fine until I tried to do the form validation. anybody see what i did wrong? Link to comment https://forums.phpfreaks.com/topic/91707-php-and-submit/ Share on other sites More sharing options...
uniflare Posted February 18, 2008 Share Posted February 18, 2008 <?php echo " <html> <head> "; if(isset($_POST["B1"])) { echo "you are in"; } ?> Link to comment https://forums.phpfreaks.com/topic/91707-php-and-submit/#findComment-469697 Share on other sites More sharing options...
schilly Posted February 18, 2008 Share Posted February 18, 2008 I usually put the js function call in the form tag using onSubmit Link to comment https://forums.phpfreaks.com/topic/91707-php-and-submit/#findComment-469701 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.