PHP mail() and dropdowns

This will take yall 2 secs…hopefully, but I just can’t figure it out.

FYI…I am a noob(google learner).

I have a Form that has a dropdown list of my fellow employees email addresses. The form will allow the user to select their email address, fill out the rest of the request and submit it.

I am using PHP to send emails(PHP Mail()) of requests I made from HTML with a Reply-to and From: header using the email address they selected in the drop down list.

But it is not giving me a from or reply to when I receive the email.

This is the (HTML and PHP) code I have so far. Don’t judge me, just help…lol ;).

[php]

<?php $email = $_POST['email']; $to = '[email protected]'; $subject = 'the subject'; $message = 'hello'; $headers = 'From: ' .$email . "\r\n" . 'Reply-To: ' .$email . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); echo "Thank You, Your request has been sent." ?>

[/php]


<form method="post" action="agent.php">


<div id="email">

<select>
   <option value="Default">-- Your Email Address --</option>
   <option name="email" id="email" value="[email protected]">Email_in_dropdown_List </option>
</select>

</div>

I figured out what I waws doing wrong. The NAME and ID values go in the part of the html and I had them in the part.

So for anyone else looking make sure you have the NAME and ID in the part of you html.

told ya it woud be easy…lol :slight_smile:

Sponsor our Newsletter | Privacy Policy | Terms of Service