Hey,
Is it possible to use the value of an input such as <input name=city type=hidden value=usa> to include in a sql select? For instance i would be wanting to
SELECT * from cities where city=the input value above. Can i make it into a variable or something to make it usable in an sql select?
Otherwise i have currently passed it to the header which works fine like this www.example.com/cities.php?city =usa .
And i have used $_GET to get the value of city.
SELECT * from cities where city LIKE '%".$city."%' . But when their is more than 1 city it doesnt work.
www.example.com/cities.php?city =usa canada
SELECT * from cities where city LIKE '%".$city."%' .
Can i split the usa and canada to be like
SELECT * from cities where city LIKE 'usa' OR city LIKE 'canada' .
Any suggestions would be great. I can easily use the input but im not sure if i can get the value out if to use in sql. otherwise can i $_GET the .php?city=usa canada to become
$city1= usa
$city2= canada
instead of $city=usa canada
thanks.
Is it possible to use the value of an input such as <input name=city type=hidden value=usa> to include in a sql select? For instance i would be wanting to
SELECT * from cities where city=the input value above. Can i make it into a variable or something to make it usable in an sql select?
Otherwise i have currently passed it to the header which works fine like this www.example.com/cities.php?city =usa .
And i have used $_GET to get the value of city.
SELECT * from cities where city LIKE '%".$city."%' . But when their is more than 1 city it doesnt work.
www.example.com/cities.php?city =usa canada
SELECT * from cities where city LIKE '%".$city."%' .
Can i split the usa and canada to be like
SELECT * from cities where city LIKE 'usa' OR city LIKE 'canada' .
Any suggestions would be great. I can easily use the input but im not sure if i can get the value out if to use in sql. otherwise can i $_GET the .php?city=usa canada to become
$city1= usa
$city2= canada
instead of $city=usa canada
thanks.
Comment