clairian Posted March 20, 2008 Share Posted March 20, 2008 Hi, I'm new to php/html and am having some trouble with my checkboxes. I want to use the on/off value of checkboxes to filter some data. The user selects the ones that they want on and then filter, which refreshes the page and passes the on/off values. However, the checkbox always goes back to being unchecked regardless of it the value selected is on or off. Any ideas how i can get the checkboxes to read whether they should be on or off. Any help would be greatly appreciated. $property = $_GET['property']; $supermarket = $_GET['supermarket']; <form method="get" action="PropMain.php" name="Amenity"> <img src="MapsIcons/house.png" /> <input type="checkbox" name="property"/> <img src="MapsIcons/basket.png" /><input type="checkbox" name="supermarket"/> <P><input name="Refresh" type="submit" value="Filter"> </form> Quote Link to comment https://forums.phpfreaks.com/topic/97111-checkboxes-onoff-status/ Share on other sites More sharing options...
rhodesa Posted March 20, 2008 Share Posted March 20, 2008 <?php $property = $_GET['property']; $supermarket = $_GET['supermarket']; ?> <form method="get" action="PropMain.php" name="Amenity"> <img src="MapsIcons/house.png" /> <input type="checkbox" name="property" <?php if($propery) print 'CHECKED';?> /> <img src="MapsIcons/basket.png" /><input type="checkbox" name="supermarket" <?php if($supermarket) print 'CHECKED';?> /> <P><input name="Refresh" type="submit" value="Filter"> </form> Quote Link to comment https://forums.phpfreaks.com/topic/97111-checkboxes-onoff-status/#findComment-496939 Share on other sites More sharing options...
soycharliente Posted March 24, 2008 Share Posted March 24, 2008 checked="checked" Quote Link to comment https://forums.phpfreaks.com/topic/97111-checkboxes-onoff-status/#findComment-499493 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.