php - Implementing Form that Might Result in Different Queries -
i have form needs allow people search hikes, hiking groups, or hikers, depending on radio button choose within form.
obviously, in either of these 3 cases, query of different tables in database, , have different usability down road. shouldn't process of these in 1 place assuming. guys agree?
what might practice way handle such case? tried redirecting request single form processing modules, had trouble making post request in url trying redirect.
ideas/suggestions appreciated, alex
i don't see problem handling 1 form. pass on search type , build appropriate query based on type, search terms, etc. if queries totally different, sounds input gathering pretty simple. may want display results different pages, processing can handled 1 form , 1 script.
quick example:
//get variables out of post if ($search_type == "hike") { //put hike query, results //call script display hikes } elseif ($search_type == "group") { //put group query, results //call script display hikes } elseif(...) //etc, etc
Comments
Post a Comment