jojoroo56 Posted October 30, 2009 Share Posted October 30, 2009 Hi, I'm a huge newbie to all of this so I'm guessing the solution will be fairly simple, but I've been racking my brain for days now. I've tried everything and I just can't seem to figure this out. I've got a contact form and the send php written, but no matter what I do I can't get the information from the dropdown selection menu to populate in the email that is generated. Please take a look at the code and I'd sure appreciate any help you could offer! Thanks!!! On the contact form I have this at the top of the page: <?php $name_of_your_site = "MichaelVenske.com"; $email_adress_reciever = "[email protected]"; if(isset($_POST['Send'])) { include('send.php'); } ?> And then this for the actual form part: <form action="" method="post" class="ajax_form"> <fieldset><?php if (!isset($error) || $error == true){ ?><legend><span>To Contact Michael Directly</span></legend> <p class="<?php echo $the_nameclass; ?>" ><input name="yourname" class="text_input empty" type="text" id="name" size="20" value='<?php echo $the_name?>'/><label for="name">Your Name*</label> </p> <p class="<?php echo $the_emailclass; ?>" ><input name="email" class="text_input email" type="text" id="email" size="20" value='<?php echo $the_email?>' /><label for="email">E-Mail*</label></p> <p><input name="website" class="text_input" type="text" id="website" size="20" value="<?php echo $the_website?>"/><label for="website">Website</label></p> <p><input name="telephone" class="text_input" type="text" id="telephone" size="20" value="<?php echo $the_telephone?>"/><label for="telephone">Telephone</label></p> <p><select name='selector'> <option value="Actor - Independent Film">Actor - Independent Film</option> <option value="Actor - Stage Play">Actor - Stage Play</option> <option value="Actor - Student Film">Actor - Student Film</option> <option value="Director - Sketch Comedy">Director - Sketch Comedy</option> <option value="Director - Stage Play">Director - Stage Play</option> <option value="Improviser">Improviser</option> <option value="Other">Other</option> <option value="Print Media">Print Media</option> <option value="Teaching - Improvisation">Teaching - Improvisation</option> <option value="Teaching - Writing Sketch Comedy">Teaching - Writing Sketch Comedy</option> <option value="Writing - Sketch Comedy">Writing - Sketch Comedy</option> <option selected="selected" value="choose">Select an Option</option> </select> <label for="selector">How can Michael contribute to your project?*</label> </p> <label for="message" class="blocklabel">Your Message*</label> <p class="<?php echo $the_messageclass; ?>"><textarea name="message" class="text_area empty" cols="40" rows="7" id="message" ><?php echo $the_message ?></textarea></p> <p> <input type="hidden" id="myemail" name="myemail" value="<?php echo $email_adress_reciever; ?>" /> <input type="hidden" id="myblogname" name="myblogname" value="<?php echo $name_of_your_site; ?>" /> <input name="Send" type="submit" value="Send" class="button" id="send" size="16"/></p> <?php } else { ?> <p><h3>Your message has been sent!</h3> Thank you!</p> <?php } ?> </fieldset> </form> And then my PHP looks like this: <?php if(isset($_POST['Send'])){ $error = false; $the_name = $_POST['yourname']; $the_email = $_POST['email']; $the_website = $_POST['website']; $the_telephone = $_POST['telephone']; $the_message = $_POST['message']; $the_selector = $_POST['selector']; if(!checkmymail($the_email)) { $error = true; $the_emailclass = "error"; }else{ $the_emailclass = "valid"; } if($the_name == "") { $error = true; $the_nameclass = "error"; }else{ $the_nameclass = "valid"; } if($the_message == "") { $error = true; $the_messageclass = "error"; }else{ $the_messageclass = "valid"; } if($error == false) { $to = $_POST['myemail']; $subject = "New Message from " . $_POST['myblogname']; $header = 'MIME-Version: 1.0' . "\r\n"; $header .= 'Content-type: text/html; charset=utf-8' . "\r\n"; $header .= 'From:'. $_POST['email'] . " \r\n"; $message1 = nl2br($_POST['message']); $message = "New message from $the_name <br/> Mail: $the_email <br /> Website: $the_website <br /> Telephone: $the_telephone <br /> How can Michael contribute to your project?: $the_selector <br /> Message: $message1<br />"; mail($to, $subject, $message, $header); if(isset($_POST['ajax'])){ echo"<h3>Your message has been sent!</h3><p> Thank you!</p>"; } } } function checkmymail($mailadresse){ $email_flag=preg_match("!^\w[\w|\.|\-]+@\w[\w|\.|\-]+\.[a-zA-Z]{2,4}$!",$mailadresse); return $email_flag; } ?> Link to comment https://forums.phpfreaks.com/topic/179636-please-help-me-with-my-form/ Share on other sites More sharing options...
cags Posted October 30, 2009 Share Posted October 30, 2009 Do you just get a blank space where you expect the value or do you get something different to what you expect? Link to comment https://forums.phpfreaks.com/topic/179636-please-help-me-with-my-form/#findComment-947882 Share on other sites More sharing options...
jojoroo56 Posted October 30, 2009 Author Share Posted October 30, 2009 I get a blank space. All the other values show up, so I'm not sure what I'm doing wrong. Link to comment https://forums.phpfreaks.com/topic/179636-please-help-me-with-my-form/#findComment-947904 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.