cdoggg94 Posted June 14, 2012 Share Posted June 14, 2012 This is not an easy thing to explain, hopefully someone will understand What I am trying to do is display an image if the "Yes" is selected and get rid of the image if "No" is selected. I have a "Pick one" option, "Yes", and "No". When the form is submitted "Yes" the image displays fine. My problem is that when the form is submitted with other entries and the selection is left alone the image still disappears. I have tried to save the database information as the value of "Pick One" so that if it is left alone it keeps what ever value it had. this is what the selection code looks like: <td width="37" style="border:1px solid #999;"><div align="center"> <select name="pack1"> <option selected="selected" value=" <?php $imageTitle = "<img src='images/check-mark.png' height='10' width='10' />"; if($det['check_1']=="Yes"){ $pic = $imageTitle; echo $pic; } if($det['check_1']=="No"){ $pic = "No"; echo $pic; } ?> ">Pick One</option> <option value="Yes">Yes</option> <option value="No">No</option> </select> </div></td> <td width="205" style="border:1px solid #999;">Package One <?php if($det['check_1']=="Yes"){ echo $imageTitle; }else{ echo $pic; } //if($det['check_1']=="<img src='images/check-mark.png' height='10' width='10' />"){ //echo "<img src='images/check-mark.png' height='10' width='10' />"; //} //if($det['check_1']=="" or $det['check_1']=="No"){ // echo "No"; //} ?> </td> The image that is attached if the complete form. The code above is for the first row only. Quote Link to comment Share on other sites More sharing options...
cdoggg94 Posted June 14, 2012 Author Share Posted June 14, 2012 sorry i have this part at the end like this: <td width="205" style="border:1px solid #999;">Package One <?php echo $pic; ?> </td> 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.