Solarpitch Posted November 7, 2007 Share Posted November 7, 2007 Hey Guys, I am trying to write a little script that when the user chooses to edit there ad on the site, it will display a list of there images as thumbnails. They then check a box for the images they want to keep. Is this the correct syntax? //See if the box has been checked $image1checked = isset($_POST['keepimage1']); if ($image1checked == "checked") --> is "checked" the correct state of a checked box if ticked? { //keep image } elseif($image1checked == NULL) { //upload new image code here $image1 = $_FILES['image1']['tmp_name']; } Quote Link to comment Share on other sites More sharing options...
aschk Posted November 7, 2007 Share Posted November 7, 2007 isset returns a boolean value does it not, so if $_POST['keepimage1'] IS set then $image1check will equal TRUE, and vica versa for NOT set. So BOTH your if statements fail... Quote Link to comment Share on other sites More sharing options...
Solarpitch Posted November 7, 2007 Author Share Posted November 7, 2007 So something like this then... if (isset($image1checked) = TRUE) { $image1 = $keep1; } elseif(!isset($image1checked) = FALSE) { $folder = "property_images/"; Quote Link to comment Share on other sites More sharing options...
RavenStar Posted November 7, 2007 Share Posted November 7, 2007 No, sometime more like.... if (isset($_POST['keepimage1'])) { // check to see if keepimage1 is set, if it IS, then proceed //keep image } else { //upload new image code here $image1 = $_FILES['image1']['tmp_name']; } Quote Link to comment Share on other sites More sharing options...
aschk Posted November 7, 2007 Share Posted November 7, 2007 Edited See ravenstar's post, if it isn't true it's going to be false Quote Link to comment 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.