php - How to make cascaded select-list form to filter the content -
im trying create search form, multiple selectable options make, model, min , max year, type of gas, new, used , few others. created search box in form of several dropdown lists appropriate values , multi checkbox.
i ask advice on how make search box created, filter content (appropriate parameters user selects in search box) showing in form of classfieds adds. im sorry values presented in native language should idea.
below code of select lists , checkbox. big answers.
<?php @ini_set("display_errors", 1);//the error handler added later in formproc error_reporting(e_all & ~((defined('e_strict')?e_strict:0)|e_notice)); require_once(dirname(__file__)."/includes/iskanje_vozil-lib.php"); $formproc_obj = new sfm_formprocessor('iskanje_vozil'); $formproc_obj->inittimezone('default'); $formproc_obj->setformid('9**66280-5820-**4b-b3**-1005ab*******'); $formproc_obj->setformkey('d**41784-8b8c-**ca-a8**-771b54******'); $formproc_obj->setlocale('sl-si','d.m.yyyy'); $formproc_obj->setemailformathtml(true); $formproc_obj->enablelogging(false); $formproc_obj->setdebugmode(false); $formproc_obj->setisinstalled(true); $formproc_obj->setprintpreviewpage(sfm_readfile(dirname(__file__)."/templ/iskanje_vozil_print_preview_file.txt")); $formproc_obj->setsingleboxerrordisplay(true); $formproc_obj->setformpage(0,sfm_readfile(dirname(__file__)."/templ/iskanje_vozil_form_page_0.txt")); $formproc_obj->addelementinfo('izberite_model','db_loadedlist',''); $formproc_obj->addelementinfo('izberite_znamko','db_loadedlist',''); $formproc_obj->addelementinfo('cena_od','db_loadedlist',''); $formproc_obj->addelementinfo('cena_do','db_loadedlist',''); $formproc_obj->addelementinfo('prvaregistracija_do','db_loadedlist',''); $formproc_obj->addelementinfo('prvaregistracija_od','db_loadedlist',''); $formproc_obj->addelementinfo('stevilokilometrov_do','db_loadedlist',''); $formproc_obj->addelementinfo('tip_goriva','db_loadedlist',''); $formproc_obj->addelementinfo('novotestnorabljeno','chk_group',''); $formproc_obj->setformdblogin('myurl','myusername','mypass','mydatabasename'); $formproc_obj->sethiddeninputtrapvarname('t**e7b62**de0b6******'); $list_handler = new fm_listhandler(); $list_handler->addlist('izberite_model',sfm_readfile(dirname(__file__)."/templ/iskanje_vozil_list_izberite_model.txt"),true); $list_handler->addlist('izberite_znamko',sfm_readfile(dirname(__file__)."/templ/iskanje_vozil_list_izberite_znamko.txt"),false); $list_handler->addlist('cena_od',sfm_readfile(dirname(__file__)."/templ/iskanje_vozil_list_cena_od.txt"),false); $list_handler->addlist('cena_do',sfm_readfile(dirname(__file__)."/templ/iskanje_vozil_list_cena_do.txt"),false); $list_handler->addlist('prvaregistracija_do',sfm_readfile(dirname(__file__)."/templ/iskanje_vozil_list_prvaregistracija_do.txt"),false); $list_handler->addlist('prvaregistracija_od',sfm_readfile(dirname(__file__)."/templ/iskanje_vozil_list_prvaregistracija_od.txt"),false); $list_handler->addlist('stevilokilometrov_do',sfm_readfile(dirname(__file__)."/templ/iskanje_vozil_list_stevilokilometrov_do.txt"),false); $list_handler->addlist('tip_goriva',sfm_readfile(dirname(__file__)."/templ/iskanje_vozil_list_tip_goriva.txt"),false); formproc_obj->addmodule($list_handler); $page_renderer = new fm_formpagedisplaymodule(); $formproc_obj->addmodule($page_renderer); $tupage = new fm_thankyoupage(sfm_readfile(dirname(__file__)."/templ/iskanje_vozil_thank_u.txt")); $formproc_obj->addmodule($tupage); $formproc_obj->processform(); ?>
and other part in form of txt file:
<!doctype html public "-//w3c//dtd xhtml 1.1//en" "http://www.w3.org/tr/xhtml11/dtd/xhtml11.dtd"> <html xmlns='http://www.w3.org/1999/xhtml'> <head > <meta http-equiv='content-type' content='text/html; charset=utf-8'/> <title >form page: iskanje_vozil</title> <script src='scripts/jquery-1.7.2.min.js' type='text/javascript'></script> <script src='scripts/jquery.sim.casclist.js' type='text/javascript'></script> <script src='scripts/jquery.sim.dynlist.js' type='text/javascript'></script> <script src='scripts/jquery.sim.utils.js' type='text/javascript'></script> <link rel='stylesheet' type='text/css' href='style/iskanje_vozil.css?r=%sfm_css_rand%'/> </head> <body id='sfm_iskanje_vozil_body'> <form id='iskanje_vozil' class='sfm_form' method='post' action='%sfm_self_script%' accept-charset='utf-8'> <div id='iskanje_vozil_errorloc' class='error_strings' style='width:300px;text-align:left'>%sfm_error_display_loc%</div> <div id='iskanje_vozil_outer_div' class='form_outer_div' style='width:300px;height:400px'> <div style='position:relative' id='iskanje_vozil_inner_div'> <input type='hidden' name='sfm_form_submitted' value='yes'/> <input type='hidden' name='%_sfm_form_id_iput_var_%' value='%_sfm_form_id_iput_value_%'/> <input type='text' name='t73e7b62d9de0b68c13fe' id='t73e7b62d9de0b68c13fe'/> <div id='label_container'> <div id='label'>znamka vozila:<br /></div> </div> <div id='label1_container'> <div id='label1'>model vozila:</div> </div> <div id='izberite_model_container'> <select name='izberite_model' id='izberite_model' size='1'></select> </div> <div id='izberite_znamko_container'> <select name='izberite_znamko' id='izberite_znamko' size='1'></select> </div> <div id='label2_container'> <div id='label2'>cena od:</div> </div> <div id='label3_container'> <div id='label3'>do:</div> </div> <div id='cena_od_container'> <select name='cena_od' id='cena_od' size='1'></select> </div> <div id='cena_do_container'> <select name='cena_do' id='cena_do' size='1'></select> </div> <div id='label5_container'> <div id='label5'>do:</div> </div> <div id='label4_container'> <div id='label4'>letnik 1.registracije od:</div> </div> <div id='prvaregistracija_do_container'> <select name='prvaregistracija_do' id='prvaregistracija_do' size='1'></select> </div> <div id='prvaregistracija_od_container'> <select name='prvaregistracija_od' id='prvaregistracija_od' size='1'></select> </div> <div id='label7_container'> <div id='label7'>tip goriva:</div> </div> <div id='label6_container'> <div id='label6'>kilometrov do:</div> </div> <div id='stevilokilometrov_do_container'> <select name='stevilokilometrov_do' id='stevilokilometrov_do' size='1'></select> </div> <div id='tip_goriva_container'> <select name='tip_goriva' id='tip_goriva' size='1'></select> </div> <div class='element_label' id='novotestnorabljeno_0_container'><input type='checkbox' name='novotestnorabljeno[]' id='novotestnorabljeno_item_0' value='novo' %f22f8affb0591c19f05ab413a0826002%/><label for='novotestnorabljeno_item_0' class='element_label' id='novotestnorabljeno_item_0_label'>novo</label></div> <div class='element_label' id='novotestnorabljeno_1_container'><input type='checkbox' name='novotestnorabljeno[]' id='novotestnorabljeno_item_1' value='rabljeno' tabindex='1' %1b2d17f8b964bdd04eaa4cca7004d736%/><label for='novotestnorabljeno_item_1' class='element_label' id='novotestnorabljeno_item_1_label'>rabljeno</label></div> <div class='element_label' id='novotestnorabljeno_2_container'><input type='checkbox' name='novotestnorabljeno[]' id='novotestnorabljeno_item_2' value='testno' tabindex='2' %7d7b87b361311f4af3d17dc49ae9109f%/><label for='novotestnorabljeno_item_2' class='element_label' id='novotestnorabljeno_item_2_label'>testno</label></div> <div id='reset_container'> <input type='button' name='reset' value='ponastavi iskanje' onclick='sfm_clear_form('form#iskanje_vozil')' id='reset'/> </div> <div id='reset1_container'> <input type='button' name='reset1' value='išči!' onclick='sfm_clear_form('form#iskanje_vozil')' id='reset1'/> </div> </div> </div> </form> <script type='text/javascript'> // <![cdata[ $(function() { $('#iskanje_vozil #izberite_model').casclist({url:'%sfm_self_script%',params:{sfm_getlist:'izberite_model'},parent:'izberite_znamko',selected_val:'%izberite_model%',parent_val:'%izberite_znamko%'}); $('#iskanje_vozil #izberite_znamko').dynlist({url:'%sfm_self_script%',params:{sfm_getlist:'izberite_znamko'},selected_val:'%izberite_znamko%'}); $('#iskanje_vozil #cena_od').dynlist({url:'%sfm_self_script%',params:{sfm_getlist:'cena_od'},selected_val:'%cena_od%'}); $('#iskanje_vozil #cena_do').dynlist({url:'%sfm_self_script%',params:{sfm_getlist:'cena_do'},selected_val:'%cena_do%'}); $('#iskanje_vozil #prvaregistracija_do').dynlist({url:'%sfm_self_script%',params:{sfm_getlist:'prvaregistracija_do'},selected_val:'%prvaregistracija_do%'}); $('#iskanje_vozil #prvaregistracija_od').dynlist({url:'%sfm_self_script%',params:{sfm_getlist:'prvaregistracija_od'},selected_val:'%prvaregistracija_od%'}); $('#iskanje_vozil #stevilokilometrov_do').dynlist({url:'%sfm_self_script%',params:{sfm_getlist:'stevilokilometrov_do'},selected_val:'%stevilokilometrov_do%'}); $('#iskanje_vozil #tip_goriva').dynlist({url:'%sfm_self_script%',params:{sfm_getlist:'tip_goriva'},selected_val:'%tip_goriva%'}); }); // ]]> </script> </body>
as stated before, id select lists , checkboxes act values in someway , filter content appropriate way... big everyone.
Comments
Post a Comment