Page 2 of 2 FirstFirst 12
Results 11 to 19 of 19
  1. #11
    Join Date
    Nov 2006
    Location
    i live on my private island!
    Posts
    366
    Tokens
    0

    Default

    in sendmail.php i had to change :
    if(empty($visitor) || empty($visitormail) || empty($notes )) {
    to:
    if(empty($name) || empty($email) || empty($main )) {
    but other then that its great
    (\_/)
    (o.o) This is Bunny. Copy Bunny to
    ('')('') help him achieve world domination.

  2. #12
    Join Date
    Jul 2006
    Location
    Athens
    Posts
    842
    Tokens
    0

    Default

    This is an updated code. Thanks to DJ CJ for pointing this out
    Now Call this sendmail.php
    Code:
    <?php
    if(!$email== "" && (!strstr($email,"@") || !strstr($email,"."))) 
    {
    die ("Invalid Email Address"); 
    }
    if(empty($name) || empty($email) || empty($main)) {
    die ("You didn't fill in all the fields");
    }
    
    $subject = $reason; 
    
    $message = "Reason: $reason \n
    Message: $main \n 
    From: $visitor ($visitormail)\n
    Additional Info : IP = $ip \n
    ";
    
    $from = "From: $email\r\n";
    
    
    mail("YourEmail", $subject, $message, $from);
    
    ?>
    Do Not edit that code unless you know what your doing.
    Where it says
    Code:
    mail("YourEmail", $subject, $message, $from);
    Edit Youremail to The email address you want it to send it to.

    There you go.


  3. #13
    Join Date
    Nov 2006
    Location
    i live on my private island!
    Posts
    366
    Tokens
    0

    Default

    yh thats better. your welcome
    (\_/)
    (o.o) This is Bunny. Copy Bunny to
    ('')('') help him achieve world domination.

  4. #14
    Join Date
    Dec 2006
    Location
    Swindon
    Posts
    3,299
    Tokens
    215
    Habbo
    dunko

    Latest Awards:

    Default

    How are you declaring $email etc? Post? Get? File?

  5. #15
    Join Date
    Jul 2006
    Location
    Athens
    Posts
    842
    Tokens
    0

    Default

    The Form is post


  6. #16
    Join Date
    Dec 2006
    Location
    Swindon
    Posts
    3,299
    Tokens
    215
    Habbo
    dunko

    Latest Awards:

    Default

    And do you have

    $email = $_POST["email"];

  7. #17
    Join Date
    Jul 2006
    Location
    Athens
    Posts
    842
    Tokens
    0

    Default

    The input form sends the data to sendmail.php


  8. #18
    Join Date
    Aug 2004
    Location
    UK
    Posts
    11,283
    Tokens
    2,031

    Latest Awards:

    Default

    How is it getting the post data? or are you neglecting to take in to account alot of peoples php set up doesnt have the automatic post/get vars to there names transformations on as there a securty risk? Hence meaning the script wont work on most setups o.0

  9. #19
    Join Date
    Dec 2006
    Location
    Swindon
    Posts
    3,299
    Tokens
    215
    Habbo
    dunko

    Latest Awards:

    Default

    Mentor said what I was trying to say in one post, well done.

    Heres update code for you:

    HTML Code:
    <form method="post" action="sendmail.php">
    Email Address: <input type="text" name="email" size="30" /><br />
    Contact Reason:<br />
    <select name="reason" size="1">
    <option value="Website Problem">Website Problem</option>
    <option value="Billing Problem">Billing Problem</option>
    <option value="Technical Support">Technical Support </option>
    <option value="Report A Staff Member ">Report A Staff Member</option>
    <option value="Other">Other (Please Specify in message)</option> 
    </select>
    <textarea name="main" rows="4" cols="30"></textarea><br />
    <input type="submit" value="Send" />
    </form>
    PHP Code:
    <?php
    $email 
    $_POST["email"];
    $name $_POST["name"];
    $main $_POST["name"];
    $reason $_POST["reason"];
    $ip $_SERVER["REMOTE_ADDR"];

    if(!
    $email== "" && (!strstr($email,"@") || !strstr($email,"."))) 
    {
    die (
    "Invalid Email Address"); 
    }
    if(empty(
    $name) || empty($email) || empty($main)) {
    die (
    "You didn't fill in all the fields");
    }

    $subject $reason

    $message "Reason: $reason \n
    Message: 
    $main \n 
    From: 
    $email \n
    Additional Info : IP = 
    $ip \n
    "
    ;

    $from "From: $email\r\n";


    mail("YourEmail"$subject$message$from);

    ?>
    That should work?
    Last edited by Blob; 24-02-2007 at 11:08 AM.

Page 2 of 2 FirstFirst 12

Posting Permissions

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