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 Like 14 Dislike
Previous forums Next forums
Other forums

Google voice
I currently have a form in html, but I want it in php so the information is not in the source code.<

PHP5 - AJAX help
I've been following the tutorial on w2schools (http://www.w3schools.com/php/php_ajax_database.asp) a

Display a default image
I am trying to display generic image for items that don't have one, but I can't get it to display.

Setting condidtions for an input box
Hi all,

I would like to set a condition in a txt box that says the number a user enters has t

Login Functionality Working Different on IE
This is an odd one, I have a site which has an admin section. The admin pages unsurprisingly require

Help with PHP Email Script
Hi guys,

I'm a newbie to php and need help with the script below:

At the moment when I

PHP Directory Listing Not working
Hey Guys,

I need help, I tried a ton of directory listing scripts and they all don't work. Al

dropdown box help - open php files to textarea
Hi, I am using tinymce to edit content located in several php files. The code I attached works but i

$variable = $variable
Hello

Sorry if this is a really simple question but I have run out of ideas. Is there a reall

Issue Parsing XML into table
Hello all,

Im a bit new to php and new to phpfreaks. But thanks in advance for the help!
<

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