The form that allowed the user to post this section was serialized using this.
Code: Select all
if(isset($_POST['int_features'])){
$int_features = serialize($_POST['int_features']);
}else{
$int_features = "";
}
if(isset($_POST['ext_features'])){
$ext_features = serialize($_POST['ext_features']);
}else{
$ext_features = "";
}
All I get is the list of the features the user can select to choose but does not have them ticked for the ones the user picked from before.
This is what the data looks like once the user has selected the features.
Code: Select all
a:7:{i:0;s:10:"Bread Oven";i:4;s:4:"Cave";i:5;s:7:"Cellier";i:10;s:7:"Cuisine";i:20;s:5:"Patio";i:23;s:10:"Pizza Oven";i:24;s:5:"Porch";}Code: Select all
<?php
$sql = mysql_query("SELECT * FROM ".TBL_INT_FEATURES." ORDER BY `int_feature` ASC");
$int_featureNo = 0;
while ($featuresentered = mysql_fetch_array($sql)){
$intfeaturesvalue = $featuresentered['int_feature'];
if(!empty($int_features)){ // if feature already selected show checked
foreach($int_features as $featVal){
if($intfeaturesvalue == $featVal){
$checked = "checked";
}
}
}
echo "<input type='checkbox' name='int_features[".$int_featureNo."]' value='".$intfeaturesvalue."'> <b>".$intfeaturesvalue."</b><hr size=1 color='#efefef'>";
$int_featureNo = $int_featureNo + 1;
$checked = "";
}
?>I really need this corrected other wise all it does is empty what was there already and put the word ARRAY instead.
So if any one can help me with this piece of code I would really appreciate it.
Thank you.