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

76 Like 14 Dislike
Previous php-forum Next php-forum
Other php-forum

Alternate messaging
I have 4 strings in MySQL db1

$string1 : Hello
$string2 : Hi
$string3 : Great
$strin

help countdown timers
hello every one,

I'd like to know how to insert many countdowns in the same page.
The dura

RSS feed - FeedList for WordPress
Hi,

I'm trying to alter the FeedList plugin for WordPress so that I can click on the title of

mail() problem
Hi Guys,

I've set up a contact email form. It sends the information fine, but it sends it to

Send inserts to mysql thru port 80
Hi!

I have an application that must do some inserts in a mysql db. This db is behind a firewa

form class help (oop php5)
Hidy Ho Neighbors,

I'm forcing myself to learn oop/classes for php5. It seems like a good id

Question handling xml data
Hello,

I have sucessfull followed this tutorial
http://www.phpfreaks.com/tutorial/handlin

Multiple Pages
Hi. Im very new to php. I'm trying to create a basic login/registration page.

So I have a bas

PDO returns erroneous columns from within pdt
Hi All,

This is a truly weird behavior:
When using a simple pdo fetch, erroneous columns a

Extract specific information from a PHP Multidimensional Array
Howdy! I've racked my brain over this for 24 hours now. I think it's time I asked for help. I'm lear

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash