I'd like to create a simple search portal that allows a user to search a product database by EITHER model number OR frequency range.
To do this, I created a form that has two submit buttons, both named 'FindButton', but with two different values, 'By Model' and 'By Range'.
My theory: If the user clicks the 'By Model' button, the 'where' section of the query string (the $sql statement, 'select __ from__ where__ order by__') should be set to the 'By Model' search criteria; if the user clicks the 'By Range' button, the 'where' section of the query string should be set to the 'By Range' search criteria.
An 'If...else' statement controls the above by testing the value in $FindButton and assigning the appropriate string to the $sql statement.
The problem is that regardless of which button is clicked, the $sql statement remains constant. In this case, it is 'stuck' on the 'By Range' criteria, even though the user may have clicked 'By Model'.
So I guess the essence of my question is, how do I implement a $sql query statement based on which submit button is clicked?
Any help would be greatly appreciated. Thanks in advance!
To do this, I created a form that has two submit buttons, both named 'FindButton', but with two different values, 'By Model' and 'By Range'.
My theory: If the user clicks the 'By Model' button, the 'where' section of the query string (the $sql statement, 'select __ from__ where__ order by__') should be set to the 'By Model' search criteria; if the user clicks the 'By Range' button, the 'where' section of the query string should be set to the 'By Range' search criteria.
An 'If...else' statement controls the above by testing the value in $FindButton and assigning the appropriate string to the $sql statement.
The problem is that regardless of which button is clicked, the $sql statement remains constant. In this case, it is 'stuck' on the 'By Range' criteria, even though the user may have clicked 'By Model'.
So I guess the essence of my question is, how do I implement a $sql query statement based on which submit button is clicked?
Any help would be greatly appreciated. Thanks in advance!