PHP: Simple Email form

  • Johan007
  • Guru
  • Guru
  • User avatar
  • Posts: 1080
  • Loc: Aldershot, UK

Post 3+ Months Ago

This email form worked on my old server but I moved host and now it does not work!

ERROR:

http://www.johandesilva.co.uk/webdesignquote2.php

Notice: Undefined index: submit in D:\Domains\johandesilva.co.uk\wwwroot\webdesignquote2.php on line 43

* = line 43

Code: [ Select ]
<?php

* if ($_POST["submit"]) { // if the submit button was pressed

    mail("info@domain.com","Web Design Quote"," ".$_POST["message"]." ","From: ".$_POST["name"]." <".$_POST["email"].">") or die("email error");

    echo "<b>Thank you, We will process your request as soon as possible.</b>";  // if all went well, display message was sent

} // end php if statement

?>
  1. <?php
  2. * if ($_POST["submit"]) { // if the submit button was pressed
  3.     mail("info@domain.com","Web Design Quote"," ".$_POST["message"]." ","From: ".$_POST["name"]." <".$_POST["email"].">") or die("email error");
  4.     echo "<b>Thank you, We will process your request as soon as possible.</b>";  // if all went well, display message was sent
  5. } // end php if statement
  6. ?>


Any ideas? Is it to do with aht version on PHP I run?
  • rtm223
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 1855
  • Loc: Uk

Post 3+ Months Ago

So you get the error before the submit button was pressed?

I would try using:

Code: [ Select ]
<?php

* if (isset($_POST["submit"])) { // if the submit button was pressed


//do stuff


} // end php if statement

?>
  1. <?php
  2. * if (isset($_POST["submit"])) { // if the submit button was pressed
  3. //do stuff
  4. } // end php if statement
  5. ?>



It seems to not like you just testing the value of the variable, because the variable does not exist. Checking to see if isset() is playing it safe.

I <i>think</i> that should work.
  • SSH-Raj
  • Expert
  • Expert
  • User avatar
  • Posts: 588

Post 3+ Months Ago

hey are you using ehostpros? i think i saw you post there.

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 42 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
 
 

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