Help with Contact Form
Posted on
16th Feb 2014 07:03 pm by
admin
I have this Form on an html page and the associated code on page.php (below).
I keep getting the "Please Fill In All Fields" message. Can you help me fix this?
I'm sure I'm just missing something. Thanks
Html page code:
Code: <form action="/page.php" method="post" name="contact_us" onSubmit="return capCheck(this);">
<table cellpadding="0" width="100%">
<tr>
<td width="10" class="required_field">*</td>
<td width="80">Your Name</td>
<td><input type="text" name="name" maxlength="50" style="width:300px" /></td>
</tr>
<tr>
<td class="required_field">*</td>
<td>Email Address</td>
<td><input type="text" name="email" maxlength="40" style="width:300px" /></td>
</tr>
<tr>
<td></td>
<td>Subject:</td>
<td><input type="text" name="subject" maxlength="40" style="width:300px" /></td>
</tr>
<tr>
<td></td>
<td>Comments:</td>
<td><textarea name="comments" style="width: 100%; height: 250px"></textarea></td>
</tr>
<tr>
<td class="required_field">*</td>
<td>Enter Image Code:</td>
<td><input type="text" value="" name="captext" style="width: 100px" maxlength="6" /></td>
</tr>
<tr>
<td></td>
<td><a onclick="refresh_security_image(); return false;" style="cursor:pointer;"><u>Refresh Image</u></a></td>
<td><img src="includes/captcha.php" border="0" id="verificiation_image" /></a></td>
</tr>
</table>
<p>
<input type="hidden" name="submited" value="1" />
<input type="submit" name="submit" value="Submit" />
</p>
</form>
PHP page code:
Code: //Start Contact Us
if($_POST['submited'] == "1"){
$your_email = "XXXXX"; //This is your email address
$from = "From: xxxxxx.com". "rn"; //This will show as the email sender.
$user_email = $_POST['email'];
$user_name = $_POST['name'];
$subject = $_POST['subject'];
$email_body = $_POST['comments'];
if($user_email == "" or $user_name == "" or $email_body == ""){
$error = "Please Fill In All Fields";
}else{
$message = "Feedback : n nUsers Email : $user_email nUsers Name : $user_name nnSubject : $subject nnn Comments : nn$email_body";
//SEND THE EMAIL
mail($your_email, $subject, $message, $from);
$result = "Your Message Has Been Sent. Thank You";
}
}
//End Contact Us
No comments posted yet
Your Answer:
Login to answer
76
14
Other forums
Passing JS to PHP
So I have the following
Code: <?php
getdetails(?><script type="text/
What are causes of a connection-timeout with fopen()?
Hello! Here is the situation: The server I host my website on just upgraded it's PHP build from 4.4.
RFQ Configuration - can you make PLANT field an optional field in ME42
Is there a way to make the plant field on an RFQ optional in change mode (ME42)?
Simple Variable Question
Hi everyone.... again,
I am really getting into php still. Learning more every day. I love it
ScriptManager History and Opera Issue
I am having an issue in opera with the ScriptManager. I have a ScriptManager on a page with history
mysql_real_escape_string
Let me preface this that I am very much a PHP noob, but I have some SQL training (not necessarily My
Not capturing all the information we require in the form.......
Hi Guys,
I was wondering if you would share some more of your knowledge today, I'm hoping it
defining website tags
Hi,
What would be the best way to define tags for my site, such as website title, url etc.
Check something, wait, check again, do something!
Hi guys.
I wonder if someone can help me with this.
Basically, what I want to do is (
Email to a friend script problems
I have this send-to-a-friend script with 2 issues:
1) When you open the form popup on a p