Thank you for reading my question.
I am building a form that will let users search a db for cards used in a collectible card game. I want to include a dropdown menu that will let users narrow their search down to a specific card expansion.
Here is my dropdown menu:
<select name="Expsn" onchange="this.submit()">
<option>All Expansions</option>
<option value="Core">Core</option>
<option value="SoM">Shadows of Mirkwood</option>
And here is the select statement:
$sql = "SELECT * FROM carddb
WHERE Expsn ='" . $_POST['Expsn'] . "' AND Type='Hero' ";
This works well when selecting either Core or MoR, but if the dropbox is left blank "All Expansions" is passed into the $_POST['Expsn']. (I use echo $sql; to output the SELECT statement). How can I set up the default to return card from all expansions.
I have spent the last few weeks learning PHP and SQL online, so it is very possible that my whole approach here is VERY wrong and not scalable, so any 'big picture' help would be greatly appreciated. Thank you.