PHP undefined variable Email

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • josel119
    New Member
    • Jan 2007
    • 2

    PHP undefined variable Email

    Hi everyone, Im a php newbie jejeej .

    Im getting the following error undefined variable at line 19 , I verified the php.ini and I dont know what else I can do. Im working on IIS with windows xp/2000.
    If someone can help , please!!

    HTML



    <body bgcolor="#00006 6">
    <form action="mail.ph p" method="post">
    <table width="740" border="0" cellspacing="0" cellpadding="0" >
    <tr>
    <td width="740" height="330" background="con tactenos.jpg">< div align="right">N ombre:
    <input type="text" name="name" >
    &nbsp;<br/>
    Email:
    <input type="text" name="email">
    &nbsp;<br/>
    Comentarios : &nbsp;&nbsp;&nb sp;<br/>
    <textarea name="message" cols="40" rows="5" ></textarea>
    &nbsp;<br/>
    <input name="submit" type="submit" value="Enviar">
    &nbsp; </div></td>
    <td>&nbsp;</td>
    </tr>
    </table>
    <br/>
    </form>



    mail.php



    <?php

    //variables (change these)


    $youremail = "nante1181@hotm ail.com";
    // your email address

    $subject = "test form";
    // the subject of the email

    $thankyou = "thankyou.p hp";
    // thank you page

    // don't change anything else

    if($email == ""){
    ?>
    <body bgcolor="#00006 6" text="#FFFFFF" link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF" >
    <div align="center"> <font face="Verdana, Arial, Helvetica, sans-serif">No introdujo
    Email. Por favor vuelva a atras.<br/>
    <?php
    }elseif($name == ""){
    ?>
    No Introdujo un nombre. Por favor vuelva a atras.<br/>
    <?php
    }elseif($messag e == ""){
    ?>
    No Introdujo un mensaje. Por favor vuelva a atras.<br/>
    <?php
    }else{

    $msg = ereg_replace("\ \\'", "'", $message);
    $msg = ereg_replace('\ \\"', "\"", $msg);
    $message1 = "from: $name\nemail: $email\nmessage :\n$msg1";

    mail($youremail , $subject, $msg, "From: $email\r\nReply-to: $email\r\n");
    ?>
    </font></div>
    <meta http-equiv="refresh" content="0; url=<?echo $thankyou;?>"">
    <?php
    }
    ?>


    thanks for your help
  • josel119
    New Member
    • Jan 2007
    • 2

    #2
    the error is on if($email=="") it seems the php file its not recognizing the html variable

    Comment

    • r035198x
      MVP
      • Sep 2006
      • 13225

      #3
      Originally posted by josel119
      the error is on if($email=="") it seems the php file its not recognizing the html variable

      //variables (change these)

      In
      [PHP]$youremail = "nante1181@hotm ail.com";
      // your email address

      $subject = "test form";
      // the subject of the email

      $thankyou = "thankyou.p hp";
      // thank you page

      // don't change anything else

      if($email == ""){
      ?>
      [/PHP]

      You define and initialize the variables
      $youremail, $subject and $thankyou
      but did not initiaze $email variable which you go on to try to use in the line
      [PHP]if($email == "
      [/PHP]
      the idea is you must declare variables before you can use them.
      PHP will not recognize variables declared inHTML

      Comment

      Working...