johnwayne77 Posted March 14, 2007 Share Posted March 14, 2007 i have a form mail on this url: main.php?url=contact the <form> action is situated on contact.php page -- self page action 1st Q) I have this: <select name="select"> <option value="select">select the address you want to message</option> <option value="[email protected]">[email protected]</option> <option value="[email protected]">[email protected]</option> </select> how do I mail the message to the selected option (office@xxx or sales@xxx) ? I suppose I equal the values to variables and some 'if' command? 2nd Q) This is the actually code of the mail form, which is included inside the contact.php page <form id="form2" name="form2" method="post" action="contact.php"> ... $recipient = '[email protected]; <--- btw, here I need the $recipient to be equal to the option selected in the List/Menu form field above $subject = stripslashes($_POST['subject']); $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "From: " .stripslashes($_POST['email']); $msg = "<p> </p>Name:<br />".stripslashes($_POST['name']); $msg .= "<p> </p>Phone:<br />".stripslashes($_POST['phone']); mail($recipient, $subject, $msg, $headers); header("Location: main.php?url=homepage");<-- this is where my problem lays: I can't set it right to redirect to another page. It keeps loading the contact.php page </form> This is the error I get: Warning: Cannot modify header information - headers already sent by (output started at /home/imobco/public_html/nicoral/contact.php:2) in /home/imobco/public_html/nicoral/contact.php on line 273 Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/42687-mail-form-2-questions-list-box-redirect/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.