I have an html page with a form that contains a couple of selectors.
The form is processed by GET via a js function that uses jquery ajax to send the data to a php page. The php builds the TSQL query to select the information.
If you don’t choose any option in the selectors I need a NULL in my query. Both in the js and php page I’ve tried with:
if($variableFromSelector1 ==’-’){ $variableFromSelector1 =’NULL’;}
if($variableFromSelector2 ==’-’){ $variableFromSelector2 =’NULL’;}
(the – means nothing chosen in the selector)
But this fills the query with ‘NULL’ which is not the same as NULL
Here's how the query goes:
function showData($variableFromSelector1,$variableFromSelector2)
{
$strSqlSelect = "EXECUTE mybd.dbo.myprocedure
@var1='".$variableFromSelector1."',
@var2='".$variableFromSelector2."'";
}
How can I get the query with NULL in case no option is chosen in the selector?
Thanks a lot