I am populating a Select with data from my database (A SQL Query). The options, for example are:
All Employees
Jack
Joe
Larry
Bob
Now the text All Employees is obviously not an actual employee name, so how would I alter my query based off the value of the Select add a where clause to my sql query?
Obviously $selectedOption = $_POST['testingselect']; would store the selected value in the variable $selectedOption and I could write my Where clause to read (hypothetical)
$SQL = "Select * from goneaz where firstname = $selectedOption"
However, if $selectedOption = All Employees nothing would be returned. How can I add dynamically add in my SQL Statement that (pseudocode) if $selectedOption = All Employees Then SQL = "Select * FROM goneaz. If $selectedOption <> All Employees THEN SQL = "Select * FROM goneaz where firstname = $selectedOption