...

View Full Version : Please Help me with SUBMIT Button



joemarieamparo
02-12-2010, 05:44 PM
I've been trying to solve this for almost 4hrs now, I am still in no where from solving this issue.

This is the complete code of the page. When I click on submit button, nothing will showed up and nothing will be sent to "contact.php". please help me. Thanks all
<"
<div id="contentArea">
<div id="contentArea11">
<div class="contentArea12">
<h2>Contact Kirk Waller</h2>
<br /><strong>Phone:</strong> 510-290-0253 <br /><br /><form id="form_email" action="contact.php" enctype="application/x-www-form-urlencoded" method="post">
<script type="text/javascript">// <![CDATA[
function FormValidate(RegForm)
{
// ----------- NAME -----------------------------------
if (document.form_email.name.value == "")
{
alert("Please enter Full Name");
document.form_email.name.focus();
return (false);
}

if (document.form_email.email.value == "")
{
alert("Please enter Email");
document.form_email.email.focus();
return (false);
}


// Check Email
var checkEmail = "@.";
var checkStr = document.form_email.email.value;
var EmailValid = false;
var EmailAt = false;
var EmailPeriod = false;
for (i = 0; i < checkStr.length; i++)
{
ch = checkStr.charAt(i);
for (j = 0; j < checkEmail.length; j++)
{
if (ch == checkEmail.charAt(j) && ch == "@")
EmailAt = true;
if (ch == checkEmail.charAt(j) && ch == ".")
EmailPeriod = true;
if (EmailAt && EmailPeriod)
break;
if (j == checkEmail.length)
break;
}
// if both the @ and . were in the string
if (EmailAt && EmailPeriod)
{
EmailValid = true
break;
}
}
if (!EmailValid)
{
alert("The \"E-mail\" field is invalid, please try again. It must contain an \"@\" and a \".\".");
document.form_email.email.focus();
return (false);
}
// ----------- NAME -----------------------------------
if (document.form_email.phone.value == "")
{
alert("Please enter Phone");
document.form_email.phone.focus();
return (false);
}
// ----------- EMAIL -----------------------------------


// ----------- Subject -----------------------------------
if (document.form_email.subject.value == "")
{
alert("Please enter Subject");
document.form_email.subject.focus();
return (false);
}
// ----------- Enquiry -----------------------------------
if (document.form_email.comments.value == "")
{
alert("Please enter comments");
document.form_email.comments.focus();
return (false);
}

//document.form_email.submit();
}
// ]]></script>
<table style="width: 829px; height: 411px;" border="0" cellspacing="4" cellpadding="4">
<tbody>
<tr align="center">
<td class="text4" style="width: 100px;" align="left"><strong>Name:</strong></td>
<td style="width: 250px;" align="left"><input class="field" name="name" size="30" type="text" /> *</td>
<td rowspan="7" valign="top">
<p><img src="images/imageq.jpg" alt="" width="388" height="194" /></p>
<pre id="line130"><br /></pre>
Ready to submit? &gt;&gt; <input type="submit" value="Submit" /></td>
</tr>
<tr>
<td class="text4"><strong>Phone:</strong></td>
<td><input id="phone" class="field" name="phone" size="30" type="text" /> *</td>
</tr>
<tr>
<td class="text4"><strong>Email:</strong></td>
<td><input class="field" name="email" size="30" type="text" /> *</td>
</tr>
<tr>
<td class="text4"><strong>Date:</strong></td>
<td><input id="date" class="field" name="date" size="30" type="text" /> *</td>
</tr>
<tr>
<td class="text4"><strong>Referred By:</strong></td>
<td><input id="reffer" class="field" name="reffer" size="30" type="text" /> *</td>
</tr>
<tr>
<td class="text4"><strong>Subjet:</strong></td>
<td><input id="subject" class="field" name="subject" size="30" type="text" /> *</td>
</tr>
<tr>
<td class="text4"><strong>Feedback:</strong></td>
<td><textarea class="mceNoEditor" cols="10" rows="5" name="comments"></textarea></td>
</tr>
</tbody>
</table>
</form></div>
</div>
</div>

">

Fumigator
02-12-2010, 06:14 PM
Read this and modify your post:

http://codingforums.com/showthread.php?t=68462

Fou-Lu
02-12-2010, 06:27 PM
Completely ignoring javascript (since this is the php forum), hitting the submit button should (and according to this, always will) transfer you to the contact.php and have the $_POST for name. I'm trying to recall offhand if it will just have name due to the location of the submit button, or if it will always have every input. I think its just the input declared before it.
As for you're javascript, I don't expect it to execute since its not called or hooked in anywhere.
If this is a question about javascript though, post that it is so I can move it from the PHP forum.

grumpy
02-12-2010, 07:19 PM
You have the submit button tags in front of most of your other inputs. Move it to the bottom of the form. Usually post submits all inputs before the "submit" as far as I know.

Fumigator
02-12-2010, 07:37 PM
You have the submit button tags in front of most of your other inputs. Move it to the bottom of the form. Usually post submits all inputs before the "submit" as far as I know.

That's completely false... the location of the submit input element has no effect on which input elements are submitted. All input elements inside the <form> and </form> tags will be submitted.

Fou-Lu
02-12-2010, 08:03 PM
That's completely false... the location of the submit input element has no effect on which input elements are submitted. All input elements inside the <form> and </form> tags will be submitted.

Thats good to know, offhand I was also uncertain, so I presumed it was just predeclared inputs as well. I guess I probably could have tested with just html and get method since I have no PHP env here.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum