artemisbow
-
Posts
6 -
Joined
-
Last visited
Never
Posts posted by artemisbow
-
-
-
-
Please... I need help! Thanks!
-
Hi, I'm using the following code to check that the form has been filled up completely
[code]if((!value1) || (!value2)... || (!valueX)){
echo "Some fields have not been filled in";
}
[/code]
However, when a user enters '0', I want the script to know that it is not empty, but neither the above method nor using empty() works. What should I do instead? Thanks!
-
Hi, I'm having problems with comparing values stored in database with values from checkbox... ok let me explain :)
Several users selects several checkbox in a form whose values are 1, 2, 3 and 4, and is submited to a script that stores the $_POST data in an array called locations[]. Following that, I did
[code]$locations = implode("|", $locations)[/code]
which gives me $locations = "1|2|3|4". $locations is then stored in a mysql table in the column user_location.
Next a visitor comes along, and in a seperate form, containing the same series of checkboxs, but selects 1 and 3, which is imploded and stored as $requiredlocations = 1|3.
Now this is where i'm stuck. The above visitor is filling up a search form to search for users who provide services in various locations. I initially thought of
[code]$sql = "SELECT * FROM users where user_location LIKE '%".$requiredlocations."%'[/code]
but that will only work if the visitor only checked a single checkbox. How should I write the code such that the visitor can search for multiple locations?
Will really appreciate any help. Thanks!
Comparing Checkbox Data in Database with Checkbox Data from $_POST
in PHP Coding Help
Posted