damiancds Posted September 2, 2009 Share Posted September 2, 2009 okay, I basically copied from the tutorial here on w3schoolsso the code, <?phpfunction spamcheck($field) { //filter_var() sanitizes the e-mail //address using FILTER_SANITIZE_EMAIL $field=filter_var($field, FILTER_SANITIZE_EMAIL); //filter_var() validates the e-mail //address using FILTER_VALIDATE_EMAIL if(filter_var($field, FILTER_VALIDATE_EMAIL)) { return TRUE; } else { return FALSE; } }if (isset($_REQUEST['email'])) {//if "email" is filled out, proceed //check if the email address is invalid $mailcheck = spamcheck($_REQUEST['email']); if ($mailcheck==FALSE) { echo "Invalid input"; } else {//send email $email = $_REQUEST['email'] ; $subject = $_REQUEST['subject'] ; $message = $_REQUEST['message'] ; mail("someone@example.com", "Subject: $subject", $message, "From: $email" ); echo "Thank you for using our mail form"; } }else {//if "email" is not filled out, display the form echo "<form method='post' action='mailform.php'> Email: <input name='email' type='text' /><br /> Subject: <input name='subject' type='text' /><br /> Message:<br /> <textarea name='message' rows='15' cols='40'> </textarea><br /> <input type='submit' /> </form>"; }?> and instead of the line " Subject: <input name='subject' type='text' /><br />"I want a drop down box listing possible subjects say: service, questions, suggestions, invoice inquiry ....thanks, Link to comment Share on other sites More sharing options...
justsomeguy Posted September 2, 2009 Share Posted September 2, 2009 Check the HTML reference, you can replace the input element with a select element with whatever options you want in it. Link to comment Share on other sites More sharing options...
damiancds Posted September 7, 2009 Author Share Posted September 7, 2009 okay, I got it.I didn't see the first form tag in the echo php, so i was trying to put a form in a form and it didn't like that.problem solved Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.