conact form in html with php

  • tirkey
  • Newbie
  • Newbie
  • tirkey
  • Posts: 11

Post 3+ Months Ago

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
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • digitalMedia
  • a.k.a. dM
  • Genius
  • User avatar
  • Posts: 5149
  • Loc: SC-USA

Post 3+ Months Ago

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).
  • tirkey
  • Newbie
  • Newbie
  • tirkey
  • Posts: 11

Post 3+ Months Ago

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
  • Gamercjm
  • Posts: 34
  • Loc: Murrietta, CA

Post 3+ Months Ago

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 90 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
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.