Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2006
    Posts
    1,026
    Tokens
    0

    Latest Awards:

    Default Help fixing PHP form

    Hey I got this form but for somereason when sending it don't show the IP etc.

    Contact.php

    PHP Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Contact us form</title>
    </head>
    <body>
    <form method="post" action="sendmail.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 ?>" />

    Your Name: <br />
    <input type="text" name="visitor" size="35" />
    <br />
    Your Email:<br />
    <input type="text" name="visitormail" size="35" />
    <br /> <br />
    <br />
    Attention:<br />
    <select name="attn" size="1">
    <option value="General">General</option> 
    <option value=" General Support ">General Support </option> 
    <option value=" Technical Support ">Technical Support </option> 
    <option value=" Webmaster ">Webmaster </option> 
    </select>
    <br /><br />
    Mail Message:
    <br />
    <textarea name="notes" rows="4" cols="40"></textarea>
    <br />
    <input type="submit" value="Send Mail" />
    </form>
    </body>
    </html>
    SendMail.php

    PHP Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    <title>Sendemail Script</title>
    </head>
    <body>
    <?php
    if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,"."))) 
    {
    echo 
    "<h2>Use Back - Enter valid e-mail</h2>\n"
    $badinput "<h2>Feedback was NOT submitted</h2>\n";
    echo 
    $badinput;
    }
    if(empty(
    $visitor) || empty($visitormail) || empty($notes )) {
    echo 
    "<h2>Use Back - fill in all fields</h2>\n";
    }
    $todayis date("l, F j, Y, g:i a") ;
    $attn $attn 
    $subject $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";

    mail("[email protected]"$subject$message$from);
    ?>
    <p align="center">
    Date: <?php echo $todayis ?> 
    <br />
    Thank You : <?php echo $visitor ?> ( <?php echo $visitormail ?> ) 
    <br />
    Attention: <?php echo $attn ?>
    <br /> 
    Message:<br /> 
    <?php $notesout str_replace("\r""<br/>"$notes); 
    echo 
    $notesout?> 
    <br />
    <?php echo $ip ?> 
    <br /><br />
    <a href="contact.php"> Next Page </a> 
    </p> 
    </body>
    </html>

  2. #2
    Join Date
    Jan 2007
    Location
    West Yorkshire
    Posts
    384
    Tokens
    0

    Default

    In the SendMail.php, you do not create the $ip variables etc.

    Try adding

    PHP Code:
    $ip $_POST['ip'];
    $httpagent $_POST['httpagent'];
    $httpref $_POST['httpref']; 
    At the top of the PHP in SendMail.php
    Last edited by ZAG; 29-01-2007 at 08:42 PM.

    “two players, two sides.
    one is light, one is dark.”
    - John Locke

  3. #3
    Join Date
    Oct 2006
    Posts
    1,026
    Tokens
    0

    Latest Awards:

    Default

    Thanks now I need the rest

    So far these work

    Date: Monday, January 29, 2007, 8:44 pm
    Thank You : ( )
    Attention:
    Message:


    I need Thank You (then name)
    Attention
    and message
    Quote Originally Posted by Th0m4s View Post
    In the SendMail.php, you do not create the $ip variables etc.

    Try adding

    PHP Code:
    $ip $_POST['ip'];
    $httpagent $_POST['httpagent'];
    $httpref $_POST['httpref']; 
    At the top of the PHP in SendMail.php

  4. #4
    Join Date
    Jan 2007
    Location
    West Yorkshire
    Posts
    384
    Tokens
    0

    Default

    PHP Code:
    $visitor $_POST['visitor'];
    $visitormail $_POST['visitormail'];
    $attn $_POST['attn'];
    $notes $_POST['notes']; 
    They are more variables you need to declare.

    “two players, two sides.
    one is light, one is dark.”
    - John Locke

  5. #5
    Join Date
    Oct 2006
    Posts
    1,026
    Tokens
    0

    Latest Awards:

    Default

    Nvm done it

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •