Jump to content

PHP and Submit


denoteone

Recommended Posts

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

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.