PHP: Simple Email form

  • Johan007
  • Guru
  • Guru
  • User avatar
  • Joined: Sep 17, 2003
  • Posts: 1080
  • Loc: Aldershot, UK
  • Status: Offline

Post June 5th, 2004, 9:07 am

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?
Read my Movie Reviews punk!
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post June 5th, 2004, 9:07 am

  • rtm223
  • Mastermind
  • Mastermind
  • User avatar
  • Joined: Mar 24, 2004
  • Posts: 1855
  • Loc: Uk
  • Status: Offline

Post June 5th, 2004, 9:19 am

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.
CSS website design tutorials
  • SSH-Raj
  • Expert
  • Expert
  • User avatar
  • Joined: Jun 03, 2004
  • Posts: 588
  • Status: Offline

Post June 5th, 2004, 9:43 am

hey are you using ehostpros? i think i saw you post there.
Teen Forums - Check them out!

Post Information

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

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