Jump to content

Checkboxes: on/off status


clairian

Recommended Posts

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>

Link to comment
Share on other sites

<?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>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.