PHP email form question for ya'll

Discussion in 'OT Technology' started by MP, Dec 10, 2004.

  1. MP

    MP New Member

    Joined:
    Sep 10, 2002
    Messages:
    34,377
    Likes Received:
    0
    Location:
    Silicon Valley
    me and one of my friends have looked over this code and can't figure out what's wrong with it. It sends me the email but in the email it is just blank with this stuff in it...



    here's contact.php
    Code:
    <?php include "../v2/header.inc" ?>
    
    <?php include "../v2/menu.inc" ?>
    
    
    <table width="100%" border="1" bordercolor="444444">
     <tr>
      <td bgcolor="444444" align="middle" colspan="2">
    
    <font color="FFFFFF" face="Verdana, Arial, Helvetica, sans-serif" size="2">
    <center>
    <strong> ·&nbsp; PKR members &nbsp;· </strong>
    </center>
    </font>
    
    </td>
     </tr>
    
    <tr>
     <td bgcolor="4d4d4d" valign="top" width="70%">
    <br>
    
    <form method="POST" action="sendeail.php">
    
    <!-- DO NOT change ANY of the php sections -->
    <?php
    $ipi = getenv("REMOTE_ADDR");
    $httprefi = getenv ("HTTP_REFERER");
    $httpagenti = getenv ("HTTP_USER_AGENT");
    ?>
    
    <input type=hidden name="ip" value="<?php echo $ipi ?>">
    <input type=hidden name="httpref" value="<?php echo $httprefi ?>">
    <input type=hidden name="httpagent" value="<?php echo $httpagenti ?>">
    
    
    <font color="FFFFFF" face="Verdana, Arial, Helvetica, sans-serif" size="2"><strong> Your Name: </strong></font><br>
    <input type=text name="visitor" size="35">
    <br>
    <font color="FFFFFF" face="Verdana, Arial, Helvetica, sans-serif" size="2"><strong> Your Email: </strong></font><br>
    <input type=text name="visitormail" size="35">
    <br>
    <font color="FFFFFF" face="Verdana, Arial, Helvetica, sans-serif" size="2"><strong> Attention: </strong></font><br>
    <select name="attn" size="1">
    <option value=" Sales n Billing ">webmaster
    <option value=" General Support ">marketing
    <option value=" Technical Support ">technical support
    <option value=" Webmaster ">Other
    </select>
    <br><br>
    <font color="FFFFFF" face="Verdana, Arial, Helvetica, sans-serif" size="2"><strong> Message: </strong></font>
    <br>
    <textarea name=notes rows=4 cols=40></textarea>
    <br>
    <input type=submit VALUE="Send Mail">
    <br>
    </form>
    
    
    </table>
    <?php include "../v2/footer.inc" ?>
    





    and here is my sendeail.php
    Code:
    <?php include "../header.inc" ?>
    
    <?php include "../menu.inc" ?>
    
    
    <table width="100%" border="1" bordercolor="444444">
     <tr>
      <td bgcolor="444444" align="middle" colspan="2">
    
    <font color="FFFFFF" face="Verdana, Arial, Helvetica, sans-serif" size="2">
    <center>
    <strong> ·&nbsp; PKR members &nbsp;· </strong>
    </center>
    </font>
    
    </td>
     </tr>
    
    <tr>
     <td bgcolor="4d4d4d" valign="top" width="70%">
    
    <!-- You must enter YOUR email address ($myemail shown below).
    Then you should check (or modify) the link for the 'next page' (at the bottom) -->
    
    <?php
                                                      $myemail = "[email protected]";
    
    if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
    {
    echo "<h2>Use Back - Enter valid e-mail</h2>\n";
    $badinput = "<h2>Feedback was NOT submitted</h2>\n";
    }
    if(empty($visitor) || empty($visitormail) || empty($notes )) {
    echo "<h2>Use Back - fill in all fields</h2>\n";
    }
    echo $badinput;
    
    $todayis = date("l, F j, Y, g:i a") ;
    
    $subject = "For " . $attn ;
    
    $notes = stripcslashes($notes);
    
    $message = " $todayis [EST] \n
    Attention: $attn \n
    Message: $notes \n
    From: $visitor ($visitormail)\n
    Additional Info : IP = $ip \n
    Browser Info: $httpagent \n
    Referral : $httpref \n
    ";
    
    $from = "From: $visitormail\r\n";
    
    if ($myemail != "")
    mail($myemail, $subject, $message, $from);
    
    ?>
    
    <b><p align=center>
    Date: <?php echo $todayis ?>
    <br>
    Thank You : <?php echo $visitor ?> ( <?php echo $visitormail ?> )
    <br>
    
    Attention: <?php echo $attn ?>
    <br>
    Message: <?php echo $notes ?>
    <br>
    <?php echo $ip ?>
    
    <br><br>
    <a href="../index.html"> back home </a>
    
    </table>
    <?php include "../v2/footer.inc" ?>
    
    any ideas?

    tia
     
    Last edited: Dec 10, 2004
  2. skooter

    skooter Guest

    Do you have register globals off? the way your script is written it would require them to be on
     
  3. WERUreo

    WERUreo Imua!

    Joined:
    Oct 15, 2003
    Messages:
    566
    Likes Received:
    0
    Location:
    Daytona Beach, Florida
    Yeah, without register_globals on, all those variables you are using in sendeail.php are empty. You can always explicitly pull those values by using $_POST.

    For example, you could say
    PHP:
    $visitor $_POST['visitor'];
    $visitormail $_POST['visitormail'];
    $attn $_POST['attn'];
    $notes $_POST['notes'];
    $ip $_POST['ip'];
    $httpagent $_POST['httpagent'];
    $httpref $_POST['httpref'];
    at the very beginning of sendeail.php.
     
  4. MP

    MP New Member

    Joined:
    Sep 10, 2002
    Messages:
    34,377
    Likes Received:
    0
    Location:
    Silicon Valley

    awesome that worked great. :coold: thanks a bunch :cool:
     

Share This Page