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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.