Hi, i have a contact form, it has a topic field that has certain options as seen below. The form is emailed to , however i want to set it up so that if a user selects the topic as advertising, it emails the form to . I want all the other topics to go to as normal. Here is my form: (please note that the small bit of PHP in the code below is used to automatically select the advertising field, incase someone automatically selects the Advertise Here link on the home page) <form name="registration" id="Upload" action="contact.processor.php" onSubmit="return validate_form(this);" enctype="multipart/form-data" method="post"> <table width="70%" border="0" cellspacing="1" cellpadding="0"> <tr> <td colspan="2" valign="bottom"><img src="images/contact.jpg"></td> </tr> <tr bgcolor="#D9D9D8"> <td width="16%" class="form">Name:</td> <td width="84%"><input type="text" name="name" size="35" maxlength="30" tabindex="1"></td> </tr> <tr bgcolor="#D9D9D8"> <td class="form">Topic:</td> <td> <?php $topic = $_GET['topic'] ?> <select style="width: 185px" name="topic" tabindex="2"> <option value="null">--- Select Question Type ---</option> <option value="Comment or Suggestion">Comment or Suggestion</option> <option value="Cancel Membership">Cancel Membership</option> <option value="Change Email Address">Change Email Address</option> <?php if ($topic == 'Advertising') { echo '<option value="Advertising" selected="selected">Advertising</option>'; } else { echo '<option value="Advertising">Advertising</option>'; } ?> <option value="Press">Press</option> <option value="Business Partnerships">Business Partnerships</option> <option value="other">- OTHER -</option> </select> </td> </tr> <tr bgcolor="#D9D9D8"> <td class="form">Mobile:</td> <td><input type="text" name="mobile" size="12" maxlength="10" value="0871234567" onFocus="this.value='';" class="form_small_text_3" tabindex="3"> </td> </tr> <tr bgcolor="#D9D9D8"> <td class="form">Email:</td> <td><input type="text" name="email" size="32" maxlength="49" tabindex="4"> </td> </tr> <tr bgcolor="#D9D9D8"> <td class="form">Message:</td> <td colspan="2" class="text"><span class="form_small_text_1"> Please type your message below</span><br> <textarea tabindex="5" cols="50" rows="8" name="message" class="form_small_text_3" wrap="physical onKeyDown="textCounter(this.form.message,this.form.remLen,1000);" onKeyUp="textCounter(this.form.message,this.form.remLen,1000); "onFocus="this.value=''; this.onfocus=null;">(Please include a contact number to help us speed up our response)</textarea> <br> <span class="form_small_text">Characters remaining: <input readonly type=text name=remLen size=4 maxlength=4 value="1000"> </td> </tr> <tr bgcolor="#D9D9D8"> <td height="35"> </td> <td> <input name="submit" tabindex="6" type="submit" id="submit" value="Send"> <input type="reset" tabindex="7" name="Reset" value="Reset"></td> </tr> <tr> <td colspan="2"><img src="images/contact_b.jpg"></td> </tr> </table> </form> HTML: Here is the email that is sent $todayis = date("l, F j, Y, g:i a") ; $name = $_POST['name']; $topic = $_POST['topic']; $mobile = $_POST['mobile']; $email = $_POST['email']; $message= $_POST['message']; $message = stripcslashes($message); $body = " $todayis [EST] \n Name: $name \n Email: $email \n Topic: $topic \n Mobile: $mobile \n Message: $message \n "; $from = "From: $email\r\n"; mail("contact@mydomain.ie", $topic, $body, $from); PHP:
Change the last line to: if ($topic == 'Advertising') $to = "advertising@mydomain.ie"; else $to = "contact@mydomain.ie"; mail($to, $topic, $body, $from); PHP:
Just a quick note:You should use divs for the container of the form, and fieldsets to hold every input.