SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Nov 2006
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Contact Sheet Help

    I set up a contact sheet for my site, but it doesn't seem to be working (I don't get the email when you click send).

    html:
    Code HTML:
    <form id="contact" method="post" action="sendeail.php">
    <?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 ?>" />
     
     
    <label for="name">Your Name:</label>
    <input type="text" id="name" name="visitor" size="35" />
    <label for="email" class="fr">Your Email:</label>
    <input type="text" id="email" name="visitormail" size="35" />
    <label for="message" class="msg">Mail Message:</label>
    <textarea name="notes" id="message" rows="9" cols="59"></textarea>
    <br />
    <input type="submit" value="Send E-Mail" />
    </form>



    php:
    Code PHP:
    <!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
     
    $ip = $_POST['ip'];
    $httpref = $_POST['httpref'];
    $httpagent = $_POST['httpagent'];
    $visitor = $_POST['visitor'];
    $visitormail = $_POST['visitormail'];
    $notes = $_POST['notes'];
    $attn = $_POST['attn'];
     
    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 (eregi('http:', $notes)) {
    die ("Do NOT try that! ! ");
    }
     
    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("donshi@gmail.com", $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.html"> Next Page </a>
    </p>
     
    </body>
    </html>

    Anyone know what I'm doing wrong?
    Last edited by donshi; Aug 7, 2007 at 17:58.

  2. #2
    SitePoint Enthusiast
    Join Date
    Sep 2006
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How did you name your php page?

    <form id="contact" method="post" action="sendeail.php"> <-- there is a typo maybe?
    <?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 ?>" />


    <label for="name">Your Name/label>
    <input type="text" id="name" name="visitor" size="35" />
    <label for="email" class="fr">Your Email/label>
    <input type="text" id="email" name="visitormail" size="35" />
    <label for="message" class="msg">Mail Message/label>
    <textarea name="notes" id="message" rows="9" cols="59"></textarea>
    <br />
    <input type="submit" value="Send E-Mail" />
    </form>

  3. #3
    SitePoint Member
    Join Date
    Nov 2006
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah that was a typo, but I named them both the same. Everything seems to work correctly.. I just never receive an email.

  4. #4
    SitePoint Evangelist praetor's Avatar
    Join Date
    Aug 2005
    Posts
    479
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try
    Code PHP:
    if (!mail("donshi@gmail.com", $subject, $message, $from)) die ('Error sending mail');


Bookmarks

Posting Permissions

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