1) Script Title: Chained Select Menu
2) Script URL (on DD): http://dynamicdrive.com/dynamicindex...menu/index.htm
3) Describe problem:
Hey all,
As I am trying to get the selected into a mailform, here's what I did:
And the php of the mail form:Code:<select class="custom-select" type="text" name="firstlevel" id="firstlevel" required></select> <select class="custom-select" type="text" name="secondlevel" id="secondlevel" required></select> <select class="custom-select" type="text" name="thirdlevel" id="thirdlevel" required></select>
But it seems like $firstlevel, $secondlevel and $thirdlevel are not recognised as a value, because they are not in the sent mail nor the recap of the sent message.Code:<?php $ip = $_SERVER['REMOTE_ADDR']; // get ip to short variable name for logging purposes $to = "contact@website.com"; $subject= "request via website"; $name = $_POST['name']; $phone = $_POST['phone']; $email = $_POST['email']; $street = $_POST['street']; $city = $_POST['city']; $firstlevel = $_POST['firstlevel']; $secondlevel = $_POST['secondlevel']; $thirdlevel = $_POST['thirdlevel']; $remarks = $_POST['remarks']; $message = " Name: $name Phone: $phone Email: $email Address: $street, $city Requested workshop: $firstlevel $secondlevel $thirdlevel Remarks: $remarks "; $mime_boundary="==Multipart_Boundary_x".md5(mt_rand())."x"; $headers = "From: $email\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: multipart/mixed;\r\n" . " boundary=\"{$mime_boundary}\""; $message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type: text/plain; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $message . "\n\n"; foreach($_FILES as $userfile) { $tmp_name = $userfile['tmp_name']; $type = $userfile['type']; $name = $userfile['name']; $size = $userfile['size']; if (file_exists($tmp_name)) { if(is_uploaded_file($tmp_name)) { $file = fopen($tmp_name,'rb'); $data = fread($file,filesize($tmp_name)); fclose($file); $data = chunk_split(base64_encode($data)); } $message .= "--{$mime_boundary}\n" . "Content-Type: {$type};\n" . " name=\"{$name}\"\n" . "Content-Disposition: attachment;\n" . " filename=\"{$fileatt_name}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n"; } } $message.="--{$mime_boundary}--\n"; if (mail($to, $subject, $message, $headers)) echo "<b>Thanks for your request.</b><br>It will be processed very shortly, so I will get back to you soon.<br>Please stay healthy in the meantime. <br> <br> <br><blockquote class='bordered layout-2'><b>This was your request:</b> <br> <br>$name <br>$street, $city <br>$phone - $email <br> <br>$firstlevel, $secondlevel, $thirdlevel <br> <br>Remarks:<br>$remarks</blockquote> "; else echo "Your request has not been processed.<br>Please try again, filling in all fields."; ?>
How to get these values work, please?
Thanks.



Reply With Quote

Bookmarks