conact form in html with php

  • tirkey
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Sep 24, 2009
  • Posts: 11
  • Status: Offline

Post November 19th, 2009, 6:30 am

hi,
i make a website in html and i also create a contact form in php.

procedure of my website: i save my webpage into "contact.html" code is -
Code: [ Select ]
<form method="post" action="sender.php">
 <input name="name" type="text" size="35" />
 <input name="company" type="text" size="35" />
 <input name="city" type="text" size="25" />     
 <textarea name="message" cols="35" rows="4" ></textarea>
 <input type="submit" name="Submit" value="Submit" />
</form>
  1. <form method="post" action="sender.php">
  2.  <input name="name" type="text" size="35" />
  3.  <input name="company" type="text" size="35" />
  4.  <input name="city" type="text" size="25" />     
  5.  <textarea name="message" cols="35" rows="4" ></textarea>
  6.  <input type="submit" name="Submit" value="Submit" />
  7. </form>
and other php code save as "sender.php" is here -
Code: [ Select ]
<?php
if(isset($_POST['submit'])) {
$to = "my email id";
$subject = "Sender Information";
$name_field = $_POST['name'];
$company_field = $_POST['company'];
$city_field = $_POST['city'];
$message = $_POST['message'];
 
$body = "From: $name_field\n Company: $company_field\n City: $city_field\n Message:\n $message"; 
echo "Data has been submitted to $to!";
mail($to, $subject, $body);
} else {
echo "Error: No Data send!";
}
?>
  1. <?php
  2. if(isset($_POST['submit'])) {
  3. $to = "my email id";
  4. $subject = "Sender Information";
  5. $name_field = $_POST['name'];
  6. $company_field = $_POST['company'];
  7. $city_field = $_POST['city'];
  8. $message = $_POST['message'];
  9.  
  10. $body = "From: $name_field\n Company: $company_field\n City: $city_field\n Message:\n $message"; 
  11. echo "Data has been submitted to $to!";
  12. mail($to, $subject, $body);
  13. } else {
  14. echo "Error: No Data send!";
  15. }
  16. ?>
but this is not working. it does'nt send any data to my email ID. What is there problem i can't understand because i am not know about php. please help me and give me your valuble and priceless feedback.

thank you.
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post November 19th, 2009, 6:30 am

  • digitalMedia
  • a.k.a. dM
  • Genius
  • User avatar
  • Joined: Dec 29, 2003
  • Posts: 5169
  • Loc: SC-USA
  • Status: Offline

Post November 19th, 2009, 6:50 am

Try this in line 2 of your PHP...
Code: [ Select ]
02.if(isset($_POST['Submit'])) {


I think it may be a simple error of case (uppercase, lowercase).
- dM
  • tirkey
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Sep 24, 2009
  • Posts: 11
  • Status: Offline

Post November 20th, 2009, 9:54 pm

I try your suggestion but this is not working, it gives such type of pop-up menu after click on submit button
Attachments:
error.JPG

pop up menu

  • Gamercjm
  • Novice
  • Novice
  • No Avatar
  • Joined: Jul 01, 2005
  • Posts: 34
  • Loc: Murrietta, CA
  • Status: Offline

Post November 21st, 2009, 4:09 am

Are you trying to run this on your local pc? I never really used php on my workstation windows box locally but you need to at least install php on your box. Or you can actually upload it to your web server and try it out..

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 140 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.