I have a form that I allow a user to update there properties details to my website that I am creating and everything shows whats in that property the user posted from before but for 2 sections does not retrieve the data the user had placed.
The form that allowed the user to post this section was serialized using this.
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 = "";
}
Now I am trying to do the opposite of that and allow the user to update the features the user want.
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.
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";}
Here is the code that I have to unserialize the information that needs correcting.
<?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 = "";
}
?>
This is the same code for EXT FEATURES!
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.