I have a simple form that should e-mail all of the entries to me when "Submit" is pressed. So far, everything works except for the Favorite Page checkboxes - which is blank in the resultant e-mail that I recieve.

Here is the code:

<?php
$msg = "Sender's Name:\t$_POST[sender_name]\n";
$msg .= "Sender's E-mail:\t$_POST[sender_email]\n";
$msg .= "Favorite Page(s):\t$_POST[favorite]\n";    //this is the line that needs fixed
$msg .= "Message Topic:\t$_POST[topic]\n";
$msg .= "Message:\t$_POST[message]\n\n";

$mailheaders = "From:\t$_POST[sender_name] <paul@kingworks.net>\n";
$mailheaders .= "Reply-To: $sender_email\n\n";

mail("pauking1@juno.com", "KINGWORKS", $msg, $mailheaders);

echo "<h1 align=center>Thank You, $_POST[sender_name]</h1>";
echo "<p align=center>I appreciate your visit, and hope to reply soon!</p>";
?>

    It might work better if you did something like this:

    <?php
    $msg = "Sender's Name:\t{$_POST['sender_name']}\n";
    $msg .= "Sender's E-mail:\t{$_POST['sender_email']}\n";
    $msg .= "Favorite Page(s):\t{$_POST['favorite']}\n";
    $msg .= "Message Topic:\t{$_POST['topic']}\n";
    $msg .= "Message:\t{$_POST['message']}\n\n";
    
    $mailheaders = "From:\t{$_POST['sender_name']}<paul@kingworks.net>\n";
    $mailheaders .= "Reply-To: $sender_email\n\n";
    
    mail("pauking1@juno.com", "KINGWORKS", $msg, $mailheaders);
    
    echo "<h1 align=center>Thank You, $_POST[sender_name]</h1>";
    echo "<p align=center>I appreciate your visit, and hope to reply soon!</p>";
    ?>
    

    If that doesn't help, I'd double check the form that is submitting the information and make sure that the field is named 'favorite.'

      I tried adding the single quotes, and got the following error:

      Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in do_sendEmail.php on line 2
      

        You have to make sure to use { and } when doing that.

        $foo['bar'] = "blah";
        // Error
        echo "Oh $foo['bar']";
        // No error
        echo "Oh {$foo['bar']}";
        

        HTH

          :o smacks forehead

          My bad, I put the {} in and get the email - it just keeps saying "Array" for Favorite Page(s).

          Maybe I should just take that part out alltogether . . .

            Write a Reply...