How to use option lists to change POST value?

Cetfeancetelp

New Member
I have a gallery page that change the category based on the $_POST("cat"), how do I use the option dropdown list to reload the page (or only the gallery) to change the gallery view accordingly.Here is the option list:\[code\] <form> <select> <option value="">Pick A Category:</option> <option value="http://stackoverflow.com/questions/3799419/1">Landscape</option> <option value="http://stackoverflow.com/questions/3799419/2">Wedding</option> <option value="http://stackoverflow.com/questions/3799419/3">Miscellaneous</option> </select> </form>\[/code\]Here is the php option list :\[code\] <?php $dir_cat[0] = "images/landscape/"; $dir_cat[1] = "images/wedding/"; $dir_cat[2] = "images/misc/"; if (isset($_POST['cat']) && isset($dir_cat[$_POST['cat']])) { // alocate image category according to the POST value $image_dir = $dir_cat[$_POST['cat']]; } else { // set default image category $image_dir = $dir_cat[0]; ?>\[/code\]
 
Back
Top