scman Posted April 21, 2006 Share Posted April 21, 2006 So I have this data base which has the same names in it as form options that I want to match at a users request. I need to pass the variable from php to mysql but I am stuck trying to do itI tried thiselseif(!$HTTP_GET_VARS['CS'] == "" and !$HTTP_GET_VARS['KS'] == ""){$result = mysql_db_query("staffdir","SELECT * from Technology WHERE SELECT * FROM technology where keywords like {$HTTP_GET_VARS[$KS]} ORDER BY last_name");Can some one point me in the right direction Quote Link to comment https://forums.phpfreaks.com/topic/8020-passing-a-php-form-variable-to-a-mysql-statment/ Share on other sites More sharing options...
wisewood Posted April 21, 2006 Share Posted April 21, 2006 Try this:SELECT * FROM Technology WHERE keywords like '%$HTTP_GET_VARS[$KS]%' ORDER BY last_name Quote Link to comment https://forums.phpfreaks.com/topic/8020-passing-a-php-form-variable-to-a-mysql-statment/#findComment-29275 Share on other sites More sharing options...
kenrbnsn Posted April 21, 2006 Share Posted April 21, 2006 Don't use $HTTP_GET_VAR, use the superglobal array $_GET. This is assuming that the method in your form is "GET" or not mentioned. If it is "POST", use the array $_POST.If you are still having problems, please post the source for your form and your script.Ken Quote Link to comment https://forums.phpfreaks.com/topic/8020-passing-a-php-form-variable-to-a-mysql-statment/#findComment-29326 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.