thornhillguy Posted May 11, 2010 Share Posted May 11, 2010 Hi I need help I have a php order form that I want to be able to have the visitor select which location the orderform will be sent to. I have incorporated a dropdown list with the 3 locations and have tried to implement the code for it but all that happens is the form becomes blank. I feel out to lunch on this and any assistance would be greatly appreciated. The entire orderform code is below and the code I'm trying to incorporate is below that <?PHP /* Simfatic Forms Main Form processor script This script does all the server side processing. (Displaying the form, processing form submissions, displaying errors, making CAPTCHA image, and so on.) All pages (including the form page) are displayed using templates in the 'templ' sub folder. The overall structure is that of a list of modules. Depending on the arguments (POST/GET) passed to the script, the modules process in sequence. Please note that just appending a header and footer to this script won't work. To embed the form, use the 'Copy & Paste' code in the 'Take the Code' page. To extend the functionality, see 'Extension Modules' in the help. */ require_once("./includes/orderform-lib.php"); $formmailobj = new FormMail("orderform"); $formmailobj->setFormPage(sfm_readfile("./templ/orderform_form_page.txt")); $formmailobj->setFormID("8ce3572f-9561-4801-a8d2-6f56e85d95f9"); $formmailobj->setFormKey("30cbf954-8edb-4ff8-bf67-053599be08f6"); $formmailobj->setEmailFormatHTML(true); $formmailobj->EnableLogging(false); $formmailobj->SetErrorEmail("[email protected]"); $formmailobj->SetDebugMode(false); $formmailobj->SetFromAddress("[email protected]"); $formmailobj->SetCommonDateFormat("m-d-Y"); $formmailobj->SetSingleBoxErrorDisplay(true); $fm_installer = new FM_FormInstaller(); $formmailobj->addModule($fm_installer); $formmailobj->setIsInstalled(true); $formfiller = new FM_FormFillerScriptWriter(); $formmailobj->addModule($formfiller); $formmailobj->AddElementInfo("pickup_delivery","radio_group"); $formmailobj->AddElementInfo("location","listbox"); $formmailobj->AddElementInfo("FirstName","text"); $formmailobj->AddElementInfo("LastName","text"); $formmailobj->AddElementInfo("Phone","text"); $formmailobj->AddElementInfo("Email","text"); $formmailobj->AddElementInfo("City","text"); $formmailobj->AddElementInfo("Street","text"); $formmailobj->AddElementInfo("delivery_time_minutes","listbox"); $formmailobj->AddElementInfo("delivery_time_hr","listbox"); $formmailobj->AddElementInfo("DatePicker","datepicker","MM-DD-YYYY"); $formmailobj->AddElementInfo("twister_total","calcfield"); $formmailobj->AddElementInfo("twister_price","decimal"); $formmailobj->AddElementInfo("twisters","text"); $formmailobj->AddElementInfo("flat_bagel_price","decimal"); $formmailobj->AddElementInfo("flat_bagels","text"); $formmailobj->AddElementInfo("flatbagel_total","calcfield"); $formmailobj->AddElementInfo("regbagels_price","decimal"); $formmailobj->AddElementInfo("reg_bagels","text"); $formmailobj->AddElementInfo("regbagels_total","calcfield"); $formmailobj->AddElementInfo("assortbuns_price","decimal"); $formmailobj->AddElementInfo("assort_buns","text"); $formmailobj->AddElementInfo("assortbuns_total","calcfield"); $formmailobj->AddElementInfo("bagelworldbreakfast_price","decimal"); $formmailobj->AddElementInfo("bagelworld_breakfast_total","calcfield"); $formmailobj->AddElementInfo("bagelworld_breakfast","listbox"); $formmailobj->AddElementInfo("bestbagel_breakfast_price","decimal"); $formmailobj->AddElementInfo("best_bagel_breakfast_total","calcfield"); $formmailobj->AddElementInfo("bestbagel_breakfast","listbox"); $formmailobj->AddElementInfo("flatbagel_platter_total","calcfield"); $formmailobj->AddElementInfo("flatbagel_platter_price","decimal"); $formmailobj->AddElementInfo("flat_bagel_platter","listbox"); $formmailobj->AddElementInfo("party_sandwich_platter_price","decimal"); $formmailobj->AddElementInfo("partysandwich_platter_total","calcfield"); $formmailobj->AddElementInfo("party_sandwich_platter","listbox"); $formmailobj->AddElementInfo("dairywrap_platter_price","decimal"); $formmailobj->AddElementInfo("dairywrap_platter_total","calcfield"); $formmailobj->AddElementInfo("dairy_wrap_platter","listbox"); $formmailobj->AddElementInfo("loxcreamcheese_platter_total","calcfield"); $formmailobj->AddElementInfo("loxcreamcheese_platter_price","decimal"); $formmailobj->AddElementInfo("loxcreamcheese_platter","listbox"); $formmailobj->AddElementInfo("smokedfish_platter_price","decimal"); $formmailobj->AddElementInfo("smokedfish_platter_total","calcfield"); $formmailobj->AddElementInfo("smokedfish_platter","listbox"); $formmailobj->AddElementInfo("vegiesdip_platter_price","decimal"); $formmailobj->AddElementInfo("vegiesdip_platter_total","calcfield"); $formmailobj->AddElementInfo("vegiesdip_platter","listbox"); $formmailobj->AddElementInfo("cheese_platter_price","decimal"); $formmailobj->AddElementInfo("cheese_platter_total","calcfield"); $formmailobj->AddElementInfo("cheese_platter","listbox"); $formmailobj->AddElementInfo("fruit_platter_total","calcfield"); $formmailobj->AddElementInfo("fruit_paltter_price","decimal"); $formmailobj->AddElementInfo("fruit_platter","listbox"); $formmailobj->AddElementInfo("garden_salad_total","calcfield"); $formmailobj->AddElementInfo("garden_salad_price","decimal"); $formmailobj->AddElementInfo("garden_salad","listbox"); $formmailobj->AddElementInfo("caesar_salad_price","decimal"); $formmailobj->AddElementInfo("caesar_salad_total","calcfield"); $formmailobj->AddElementInfo("caesar_salad","listbox"); $formmailobj->AddElementInfo("greek_salad_price","decimal"); $formmailobj->AddElementInfo("greek_salad_total","calcfield"); $formmailobj->AddElementInfo("greek_salad","listbox"); $formmailobj->AddElementInfo("spinich_salad_total","calcfield"); $formmailobj->AddElementInfo("spinich_salad_price","decimal"); $formmailobj->AddElementInfo("spinich_salad","listbox"); $formmailobj->AddElementInfo("goat_cheese_price","decimal"); $formmailobj->AddElementInfo("goat_cheese_total","calcfield"); $formmailobj->AddElementInfo("goat_cheese","listbox"); $formmailobj->AddElementInfo("minidanish15_price","decimal"); $formmailobj->AddElementInfo("mini_danish_15","text"); $formmailobj->AddElementInfo("minidanish30_price","decimal"); $formmailobj->AddElementInfo("mini_danish_30","text"); $formmailobj->AddElementInfo("minidanish45_price","decimal"); $formmailobj->AddElementInfo("mini_danish_total","calcfield"); $formmailobj->AddElementInfo("mini_danish_45","text"); $formmailobj->AddElementInfo("cookie15_price","decimal"); $formmailobj->AddElementInfo("cookie_15","text"); $formmailobj->AddElementInfo("cookies30_price","decimal"); $formmailobj->AddElementInfo("cookies_30","text"); $formmailobj->AddElementInfo("cookies45_price","decimal"); $formmailobj->AddElementInfo("cookies_total","calcfield"); $formmailobj->AddElementInfo("cookies_45","text"); $formmailobj->AddElementInfo("rugalach15_price","decimal"); $formmailobj->AddElementInfo("rugalach_15","text"); $formmailobj->AddElementInfo("rugalach30_price","decimal"); $formmailobj->AddElementInfo("rugalach_30","text"); $formmailobj->AddElementInfo("rugalach45_price","decimal"); $formmailobj->AddElementInfo("rugalech_total","calcfield"); $formmailobj->AddElementInfo("rugalach_45","text"); $formmailobj->AddElementInfo("canned_pop","text"); $formmailobj->AddElementInfo("canned_pop_total","calcfield"); $formmailobj->AddElementInfo("canned_pop_price","decimal"); $formmailobj->AddElementInfo("bottled_water","text"); $formmailobj->AddElementInfo("bottled_water_total","calcfield"); $formmailobj->AddElementInfo("bottled_water_price","decimal"); $formmailobj->AddElementInfo("tropicana_oj","text"); $formmailobj->AddElementInfo("tropicana_oj_total","calcfield"); $formmailobj->AddElementInfo("tropicana_oj_price","decimal"); $formmailobj->AddElementInfo("milk","text"); $formmailobj->AddElementInfo("milk_total","calcfield"); $formmailobj->AddElementInfo("milk_price","decimal"); $formmailobj->AddElementInfo("freshsqueezed","text"); $formmailobj->AddElementInfo("freshsqueezed_total","calcfield"); $formmailobj->AddElementInfo("freshsqueezed_price","decimal"); $formmailobj->AddElementInfo("coffee_price","decimal"); $formmailobj->AddElementInfo("coffee_total","calcfield"); $formmailobj->AddElementInfo("coffee","listbox"); $formmailobj->AddElementInfo("total_order","calcfield"); $formmailobj->AddElementInfo("sub_total","calcfield"); $formmailobj->AddElementInfo("tax","calcfield"); $formmailobj->AddElementInfo("Instructions","multiline"); $formmailobj->AddDefaultValue("304b22532e28059f03154d3107b1bcc8","checked=\"checked\""); $formmailobj->AddDefaultValue("f11f79ec9ba786c3215cdca334330a2b","selected=\"selected\""); $formmailobj->AddDefaultValue("Phone","xxx-xxx-xxxx"); $formmailobj->AddDefaultValue("10a7433ea53735ecd9950f2250b53a9d","selected=\"selected\""); $formmailobj->AddDefaultValue("24e5cb307133f9aedcb9c15b63df6e49","selected=\"selected\""); $formmailobj->AddDefaultValue("twister_price","0.99"); $formmailobj->AddDefaultValue("twisters","0"); $formmailobj->AddDefaultValue("flat_bagel_price","0.99"); $formmailobj->AddDefaultValue("flat_bagels","0"); $formmailobj->AddDefaultValue("regbagels_price","0.99"); $formmailobj->AddDefaultValue("reg_bagels","0"); $formmailobj->AddDefaultValue("assortbuns_price","0.99"); $formmailobj->AddDefaultValue("assort_buns","0"); $formmailobj->AddDefaultValue("bagelworldbreakfast_price","7.99"); $formmailobj->AddDefaultValue("bestbagel_breakfast_price","9.99"); $formmailobj->AddDefaultValue("flatbagel_platter_price","7.99"); $formmailobj->AddDefaultValue("party_sandwich_platter_price","3.99"); $formmailobj->AddDefaultValue("dairywrap_platter_price","7.99"); $formmailobj->AddDefaultValue("loxcreamcheese_platter_price","10.99"); $formmailobj->AddDefaultValue("smokedfish_platter_price","14.95"); $formmailobj->AddDefaultValue("vegiesdip_platter_price","2.95"); $formmailobj->AddDefaultValue("cheese_platter_price","3.95"); $formmailobj->AddDefaultValue("fruit_paltter_price","3.49"); $formmailobj->AddDefaultValue("garden_salad_price","1.99"); $formmailobj->AddDefaultValue("caesar_salad_price","2.99"); $formmailobj->AddDefaultValue("greek_salad_price","2.99"); $formmailobj->AddDefaultValue("spinich_salad_price","2.99"); $formmailobj->AddDefaultValue("goat_cheese_price","2.99"); $formmailobj->AddDefaultValue("minidanish15_price","14.99"); $formmailobj->AddDefaultValue("mini_danish_15","0"); $formmailobj->AddDefaultValue("minidanish30_price","29.99"); $formmailobj->AddDefaultValue("mini_danish_30","0"); $formmailobj->AddDefaultValue("minidanish45_price","44.99"); $formmailobj->AddDefaultValue("mini_danish_45","0"); $formmailobj->AddDefaultValue("cookie15_price","9.99"); $formmailobj->AddDefaultValue("cookie_15","0"); $formmailobj->AddDefaultValue("cookies30_price","19.99"); $formmailobj->AddDefaultValue("cookies_30","0"); $formmailobj->AddDefaultValue("cookies45_price","29.99"); $formmailobj->AddDefaultValue("cookies_45","0"); $formmailobj->AddDefaultValue("rugalach15_price","7.99"); $formmailobj->AddDefaultValue("rugalach_15","0"); $formmailobj->AddDefaultValue("rugalach30_price","15.49"); $formmailobj->AddDefaultValue("rugalach_30","0"); $formmailobj->AddDefaultValue("rugalach45_price","23.49"); $formmailobj->AddDefaultValue("rugalach_45","0"); $formmailobj->AddDefaultValue("canned_pop","0"); $formmailobj->AddDefaultValue("canned_pop_price","1.75"); $formmailobj->AddDefaultValue("bottled_water","0"); $formmailobj->AddDefaultValue("bottled_water_price","1.75"); $formmailobj->AddDefaultValue("tropicana_oj","0"); $formmailobj->AddDefaultValue("tropicana_oj_price","1.75"); $formmailobj->AddDefaultValue("milk","0"); $formmailobj->AddDefaultValue("milk_price","2"); $formmailobj->AddDefaultValue("freshsqueezed","0"); $formmailobj->AddDefaultValue("freshsqueezed_price","4.99"); $formmailobj->AddDefaultValue("coffee_price","1"); $formmailobj->AddDefaultValue("218206895fa576fc72a1865020958469","selected=\"selected\""); $page_renderer = new FM_FormPageRenderer(); $formmailobj->addModule($page_renderer); $validator = new FM_FormValidator(); $validator->addValidation("location","dontselect=Select Location","Please select an option for location"); $validator->addValidation("FirstName","req","Please fill in FirstName"); $validator->addValidation("LastName","req","Please fill in LastName"); $validator->addValidation("Phone","req","Please fill in Phone"); $validator->addValidation("Phone","regexp=/(?:[\\(][0-9]{3}[\\)]|[0-9]{3})[-. ]?[0-9]{3}[-. ]?[0-9]{4}$/","Please enter a valid input for Phone"); $validator->addValidation("Email","email","The input for Email should be a valid email value"); $validator->addValidation("Email","req","Please fill in Email"); $validator->addValidation("delivery_time_minutes","dontselect=MN","Please select an option for delivery_time_minutes"); $validator->addValidation("delivery_time_hr","dontselect=HR","Please select an option for delivery_time_hr"); $validator->addValidation("twister_price","numeric","The input for should be a valid numeric value"); $validator->addValidation("flat_bagel_price","numeric","The input for should be a valid numeric value"); $validator->addValidation("regbagels_price","numeric","The input for should be a valid numeric value"); $validator->addValidation("assortbuns_price","numeric","The input for should be a valid numeric value"); $validator->addValidation("bagelworldbreakfast_price","numeric","The input for should be a valid numeric value"); $validator->addValidation("bestbagel_breakfast_price","numeric","The input for should be a valid numeric value"); $validator->addValidation("flatbagel_platter_price","numeric","The input for should be a valid numeric value"); $validator->addValidation("party_sandwich_platter_price","numeric","The input for should be a valid numeric value"); $validator->addValidation("dairywrap_platter_price","numeric","The input for should be a valid numeric value"); $validator->addValidation("loxcreamcheese_platter_price","numeric","The input for should be a valid numeric value"); $validator->addValidation("smokedfish_platter_price","numeric","The input for should be a valid numeric value"); $validator->addValidation("vegiesdip_platter_price","numeric","The input for should be a valid numeric value"); $validator->addValidation("cheese_platter_price","numeric","The input for should be a valid numeric value"); $validator->addValidation("fruit_paltter_price","numeric","The input for should be a valid numeric value"); $validator->addValidation("garden_salad_price","numeric","The input for should be a valid numeric value"); $validator->addValidation("caesar_salad_price","numeric","The input for should be a valid numeric value"); $validator->addValidation("greek_salad_price","numeric","The input for should be a valid numeric value"); $validator->addValidation("spinich_salad_price","numeric","The input for should be a valid numeric value"); $validator->addValidation("goat_cheese_price","numeric","The input for should be a valid numeric value"); $validator->addValidation("minidanish15_price","numeric","The input for should be a valid numeric value"); $validator->addValidation("minidanish30_price","numeric","The input for should be a valid numeric value"); $validator->addValidation("minidanish45_price","numeric","The input for should be a valid numeric value"); $validator->addValidation("cookie15_price","numeric","The input for should be a valid numeric value"); $validator->addValidation("cookies30_price","numeric","The input for should be a valid numeric value"); $validator->addValidation("cookies45_price","numeric","The input for should be a valid numeric value"); $validator->addValidation("rugalach15_price","numeric","The input for should be a valid numeric value"); $validator->addValidation("rugalach30_price","numeric","The input for should be a valid numeric value"); $validator->addValidation("rugalach45_price","numeric","The input for should be a valid numeric value"); $validator->addValidation("canned_pop_price","numeric","The input for should be a valid numeric value"); $validator->addValidation("bottled_water_price","numeric","The input for should be a valid numeric value"); $validator->addValidation("tropicana_oj_price","numeric","The input for should be a valid numeric value"); $validator->addValidation("milk_price","numeric","The input for should be a valid numeric value"); $validator->addValidation("freshsqueezed_price","numeric","The input for should be a valid numeric value"); $validator->addValidation("coffee_price","numeric","The input for should be a valid numeric value"); $validator->addValidation("Instructions","maxlen=2000","The length of the input for Instructions should not exceed 2000"); $validator->addValidation("Instructions","regexp=/^[^<>@]*$/","Please enter a valid input for Instructions"); $formmailobj->addModule($validator); $confirmpage = new FM_ConfirmPage(sfm_readfile("./templ/orderform_confirm_page.txt")); $confirmpage->SetButtonCode(sfm_readfile("./templ/orderform_confirm_button_code.txt"),sfm_readfile("./templ/orderform_edit_button_code.txt"),sfm_readfile("./templ/orderform_print_button_code.txt")); $confirmpage->SetExtraCode(sfm_readfile("./templ/orderform_confirm_ie6_png_fix.txt")); $formmailobj->addModule($confirmpage); $data_email_sender = new FM_FormDataSender(sfm_readfile("./templ/orderform_email_subj.txt"),sfm_readfile("./templ/orderform_email_body.txt"),"%Email%"); $data_email_sender->AddToAddr("administrator<[email protected]>"); $data_email_sender->AddToAddr("Head Office<[email protected]>"); $formmailobj->addModule($data_email_sender); $autoresp = new FM_AutoResponseSender(sfm_readfile("./templ/orderform_resp_subj.txt"),sfm_readfile("./templ/orderform_resp_body.txt")); $autoresp->SetToVariables("FirstName","Email"); $formmailobj->addModule($autoresp); $tupage = new FM_ThankYouPage(sfm_readfile("./templ/orderform_thank_u.txt")); $formmailobj->addModule($tupage); $formmailobj->ProcessForm(); ?> //-----Added Code Start--------- if(isset($_POST['sfm_form_submitted'])) { if($_POST['location']) == 'Wilson') { $data_email_sender->AddToAddr("[email protected]>"); } elseif($_POST['location']) == 'Queen') { $data_email_sender->AddToAddr("[email protected]>"); } elseif($_POST['location']) == 'Thornhill') { $data_email_sender->AddToAddr("[email protected]>"); } } //-----Added Code End --------- Quote Link to comment https://forums.phpfreaks.com/topic/201369-lost-in-php/ Share on other sites More sharing options...
kenrbnsn Posted May 11, 2010 Share Posted May 11, 2010 When you post code, please surround the code with tags. Ken Quote Link to comment https://forums.phpfreaks.com/topic/201369-lost-in-php/#findComment-1056501 Share on other sites More sharing options...
Muddy_Funster Posted May 11, 2010 Share Posted May 11, 2010 <---- is now officialy ignoring people who can't post code between tags. Quote Link to comment https://forums.phpfreaks.com/topic/201369-lost-in-php/#findComment-1056502 Share on other sites More sharing options...
Adam Posted May 11, 2010 Share Posted May 11, 2010 I'm afraid I - and more than likely most people here - are unfamiliar with the class you're using to generate and handle the form. How are we supposed to tell you how it's done? Quote Link to comment https://forums.phpfreaks.com/topic/201369-lost-in-php/#findComment-1056503 Share on other sites More sharing options...
kenrbnsn Posted May 11, 2010 Share Posted May 11, 2010 A quick web search for "Simfatic Forms" came up with http://simfatic.com/ Ken Quote Link to comment https://forums.phpfreaks.com/topic/201369-lost-in-php/#findComment-1056507 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.