Hi all...
Am hoping someone can show me what I have done wrong here. I had a form with two select lists and one set of checkboxes that needed to get completed.. all well and good and it worked fine but I have eveolved the system and added a condition to only display those items if a condition was true. The resulting form had to show the select lists and checkboxes as well as display the already selected item in the database and although the form is displaying correctly against the conditon and the select lsits and checkbox items are displaying when they are supposed to the problem I cannot solve is that when making slections form the slect lists and checkboxes and submitting the form is submitting ok but it is inseritn ghe words "selected" or "checked" into the database together with the slected items like so for the checkboxeslcheckedfcheckedschecked and queenselected for the select lists.
My code looks like this
<td> </td>
</tr>
<?php if( $tour['accomm'] == "Yes" || $catid !="") {
echo "
<tr>
<td><b> Room Class</b></td>
<td> <select name=\"class\">
<option value=\"stateroom"; if($cat['class'] == "stateroom"); echo "selected\"; >Stateroom</option>
<option value=\"suite"; if($cat['class'] == "suite"); echo "selected\" >Suite</option>
<option value=\"superior"; if($cat['class'] == "superior"); echo "selected\" >Superior</option>
<option value=\"first class"; if($cat['class'] == "first class"); echo "selected\" >First Class</option>
<option value=\"standard"; if($cat['class'] == "standard"); echo "selected\" >Standard</option>
<option value=\"budget"; if($cat['class'] == "budget"); echo "selected\" >Budget</option>
<option value=\"dormitory"; if($cat['class'] == "dormitory"); echo "selected\" >Dormitory</option>
<option value=\"caravan"; if($cat['class'] == "caravan"); echo "selected\" >Caravan</option>
<option vlue=\"Trailer"; if($cat['class'] == "trailer"); echo "selected\" >Trailer</option>
<option vlue=\"Tent"; if($cat['class'] == "tent"); echo "selected\" >Tent</option>
</select>
</td>
</tr>
<tr>
<td><b>Type of Bed(s)</b></td>
<td> <select name=\"bedtype\">
<option value=\"queen"; if($cat['bedtype'] == "queen"); echo "selected\"; >Queen</option>
<option value=\"king"; if($cat['bedtype'] == "king"); echo "selected\"; >King</option>
<option value=\"double"; if($cat['bedtype'] == "double"); echo "selected\"; >Double</option>
<option value=\"three-quarter"; if($cat['bedtype'] == "three-quarter"); echo "selected\"; >Three-Quarter</option>
<option value=\"single"; if($cat['bedtype'] == "single"); echo "selected\"; >Single</option>
<option value=\"bunk"; if($cat['bedtype'] == "bunk"); echo "selected\"; >Bunk</option>
<option value=\"berth"; if($cat['bedtype'] == "berth"); echo "selected\"; >Berth</option>
<option value=\"mixed"; if($cat['bedtype'] == "mixed"); echo "selected\"; >Mixed</option>
</select></td>
</tr>
</table>
<br>
<b>HOTEL FACILITIES</b><br>
<table width=\"40%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr>
<td align=\"right\"><input type=\"checkbox\" name=\"fac_tel\" value=\"l"; if( strpos($cat['facilities'], "l") > -1); echo "checked\" ></td>
<td align=\"center\"><img src=\"../images/icons/ico_phone.gif\" width=\"26\" height=\"27\"></td>
<td align=\"left\">Telephone</td>
</tr>
<tr>
<td align=\"right\"><input type=\"checkbox\" name=\"fac_safe\" value=\"f"; if( strpos($cat['facilities'], "f") > -1); echo "checked\" ></td>
<td align=\"center\"><img src=\"../images/icons/ico_safe.gif\" width=\"26\" height=\"27\"></td>
<td align=\"left\">Safe</td>
</tr>
<tr>
<td align=\"right\"><input type=\"checkbox\" name=\"fac_smoke\" value=\"s"; if( strpos($cat['facilities'], "s") > -1); echo "checked\" ></td>
<td align=\"center\"><img src=\"../images/icons/ico_smoke.gif\" width=\"26\" height=\"27\"></td>
<td align=\"left\">Smoking Permitted</td>
</tr>
<tr>
<td align=\"right\"><input type=\"checkbox\" name=\"fac_tv\" value=\"m"; if( strpos($cat['facilities'], "t") > -1); echo "checked\" ></td>
<td align=\"center\"><img src=\"../images/icons/ico_tv_sat.gif\" width=\"26\" height=\"27\"></div></td>
<td align=\"left\">Satelite Television</td>
</tr>
<tr>
<td align=\"right\"><input type=\"checkbox\" name=\"fac_pets\" value=\"e"; if( strpos($cat['facilities'], "e") > -1); echo "checked\" ></td>
<td align=\"center\"><img src=\"../images/icons/ico_pets.gif\" width=\"26\" height=\"27\"></div></td>
<td align=\"left\">No Pets</td>
</tr>
<tr>
<td align=\"right\"><input type=\"checkbox\" name=\"fac_park\" value=\"c"; if( strpos($cat['facilities'], "c") > -1); echo "checked\" ></td>
<td align=\"center\"><img src=\"../images/icons/ico_cover_park.gif\" width=\"26\" height=\"27\"></td>
<td align=\"left\">Covered Parking</td>
</tr>
<tr>
<td align=\"right\"><input type=\"checkbox\" name=\"fac_towels\" value=\"o"; if( strpos($cat['facilities'], "o") > -1); echo "checked\" ></td>
<td align=\"center\"><img src=\"../images/icons/ico_towels.gif\" width=\"26\" height=\"27\"></td>
<td align=\"left\">Towels Supplied</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td align=\"right\"> </td>
</tr>";
}
?>
I have tried echoing each line but that dod not display anything and it also seemed a rather long way around.. can anyone point me right?