Splitting up a .PHP form
I'm working with a .PHP file which holds a form.
this form allows the user to choose:
-A Price Range
- Search Keywords
- Search Location
when the user presses the submit button,
content displayed from another .PHP file is updated.
Is there a way for me to split a form like this, up into different php files for each function of the form. For example, one .PHP file for categories, subcategories, search keywords, etc...
One way would be to have it call one file, then use some branching logic in that file to include the file you want to process that type of request.
There are a few options. NogDog's way is one. You can jump to different functions in the same file.
You could use switch/case instead of if.
$choice = isset($_POST['some_field']) ? $_POST['some_field'] : '';
if($choice == 'c')
elseif($choice == 's')
else die('Stop trying to call my PHP file directly.')
thank you very much