jrapin Posted November 17, 2006 Share Posted November 17, 2006 I'm attempting to program a form with a pop-up menu to submit the choices a user makes.Previously the form was using the checkboxes effectively (Thanks to Orio), but I wanted to condense the information a little more. Right now the code uses this as this array method:$checkboxes = array("apples", "oranges", "grapes", "pears");foreach ($checkboxes as $checkbox){if(isset($_POST[$checkbox]))echo $checkbox." is requested, ";}mail("[email protected]","Dinner Reservations",$message,$headers);How can I program it so that it submits the pop-up selections instead?[attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/27584-php-pop-up-form-submission/ Share on other sites More sharing options...
craygo Posted November 17, 2006 Share Posted November 17, 2006 Not sure I understand what you want to do. By pop-up are you talking about the dropdown menu???Can you explain a little more??Ray Link to comment https://forums.phpfreaks.com/topic/27584-php-pop-up-form-submission/#findComment-126152 Share on other sites More sharing options...
jrapin Posted November 17, 2006 Author Share Posted November 17, 2006 Correct, its basically a drop down menu, the user makes a selction or choice and the results need to be submited to an e-mail address. Please help with the code in question. Link to comment https://forums.phpfreaks.com/topic/27584-php-pop-up-form-submission/#findComment-126156 Share on other sites More sharing options...
craygo Posted November 17, 2006 Share Posted November 17, 2006 Well in order to send the results to an e-mail address you will have to make this a form and submit it. Once it is submitted you can pull the values and put them into a properly formatted e-mail.first you need to add a submit button.then you need to change your fruit linesthey should be[code] <p>Name of Fruit: <select name="fruit"> <option value="Apples">Apples</option> <option value="Oranges">Oranges</option> <option value="Grapes">Grapes</option> <option value="Pears">Pears</option> </select> <select name="amount"> <option vlue="1">One</option> <option vlue="2">Two</option> <option vlue="3">Three</option> <option vlue="4">Four</option> <option vlue="5">Five</option> </select>[/code]Then you just call them in the e-mail part.[code] $headers = "From:".$_POST['email_address']."\r\n"; $headers .= "Content-Type: text/plain;\r\n charset=iso-8859-1\r\n"; $message = "Name: " . $_POST['first'] . " " . $_POST['last'] . "\r\n"; $message .= "Email: " . $_POST['email_address'] . "\r\n"; $message .= "Phone: " . $_POST['phone'] . "\r\n"; $message .= "Organization: " . $_POST['organization'] . "\r\n"; $message .= $_POST['message_body']."\r\n"; $message .= "You have selected ".$_POST['amount']." ".$_POST['fruit']." as your fruit choice\r\n";[/code]Or however you want to get them.I keep getting an error in your script about the message body. Where is this coming from??Ray Link to comment https://forums.phpfreaks.com/topic/27584-php-pop-up-form-submission/#findComment-126161 Share on other sites More sharing options...
jrapin Posted November 17, 2006 Author Share Posted November 17, 2006 I'm not concerned about the body error message - the code is fully functional.I need some additional help - to make the menu more interactive. I was thinking of the else coommand or else if.What I ned it to do is this:for each catagory, a complimentary menu will adjust to that particular item. For example, If the user chooses Apples, they can pick an amount of one to five. If the user chooses oranges, they choose between six and ten and if they pick grapes they will have the option on selecting eleven to fifteen.How can this be done? Link to comment https://forums.phpfreaks.com/topic/27584-php-pop-up-form-submission/#findComment-126291 Share on other sites More sharing options...
chiprivers Posted November 17, 2006 Share Posted November 17, 2006 So you want two drop down selection boxes in a form, the second of which populates dependant on the value selected in the first box. Is this right?If you want to do it with PHP, I think you will want to reload the page on selection in the first box. A script on the page can check if a value has been selected in the first box, if it has then query a database table that contains the values for the second box that relates to the first selection.I think you can probably also do the same without reloading the page using either Java Script of CSS, not sure about those methods though? Link to comment https://forums.phpfreaks.com/topic/27584-php-pop-up-form-submission/#findComment-126318 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.