I'm not sure of the correct terminology, but here is what I'm looking to develop:
Like monster.com or any of the major job search companies, I'd like to create a database connected to an online form, with two dropdown menus, which will provide filtered search results upon submit.
For example:
First dropdown menu: Arizona, Alaska, Alabama
Second menu: Carpenters, Plumbers, Auto Repair
If the user were to select Arizona, Carpenters and click submit, the next page would be a listing of all the Carpenters in AZ.
I believe I'll have to incorporate PHP/MySQL, but I'd like any advice or resources that might be available.
Yes, you got it right. You can use PHP and MySQL to do that. I suggest you learn some basic SQL select statements. Then use PHP to pass post/get to next page for processing the sql select statement. A little pseudo-code here, assuming you know a little about HTML in the first place!
Code:
// THIS IS IN THE SELECTION PAGE
<form action="showJobs.php" method="post">
<select name="cboLocation">
<option value="" selected="selected">Choose a state</option>
<option value="arizona">Arizona</option>
<option value="alaska">Alaska</option>
</select>
<select name="cboJob">
<option value="" selected="selected">Choose a job</option>
<option value="arizona">Carpenters</option>
<option value="alaska">Plumbers</option>
</select>
<input type="submit" value="search jobs" />
</form>
Code:
// THIS IS IN THE FILTERED PAGE
<?php
$dState = $_POST["cboLocation"];
$dJob = $_POST["cboJob"];
$sqlQuery = "SELECT * FROM tblJobs WHERE state=\"$dState\" AND job=\"$dJob\"";
//RUN THE QUERY
//DISPLAY RESULT
?>
Consult the PHP manual at php.net and search for MySQL.
I'm doing something a little similar, and can't for the life of my figure out how to do the following (I'm also brand new to php and mysql):
Let's say, using the OP's example, that I have the two menus (one with Arizona, Alaska, and Alabama, and one with Carpenters, Plumbers, and Auto Repair).
However, instead of requiring both a 'state' and a 'job,' the user has the option of selecting just one or the other, so that if the user selects "Arizona" and leaves the 'jobs' menu as is (for example, at the default option of '-----' or 'Jobs'), we would be returned all of the carpenters, plumbers, and auto mechanics in Arizona. Or if the state was left at the default, and 'carpenters' was selected, then all the carpenters in Arizona, Alaska, and Alabama would be returned.
Bookmarks