matthewst
05-07-2010, 08:28 PM
I have XMLHttpRequest working. The problem is when a user selects a checkbox in my form the next refresh clears it.
echo "<form name='mark_sold' action='mark_sold.php' enctype='multipart/form-data' method='post'><table width='1100' border='1'><tr><td><h2>Spot 1</h2>";
foreach ($rest_ids as $id){
//$rest_ids = implode("' or '", $rest_ids);
//$rest_ids = "'" . $rest_ids . "'";
$Get_Ad = mysql_query("SELECT rest_id, rest_name, city, ad_space1 FROM restaurant_info WHERE rest_id = $id");
$got_ad = mysql_fetch_assoc($Get_Ad);
$is_sold = $got_ad['ad_space1'];
$rest_id = $got_ad['rest_id'];
$rest_name = $got_ad['rest_name'];
$city = $got_ad['city'];
if($is_sold){
$is_sold = "<font color='red'>sold</font><input name='ad1' type='hidden' value='1' /><input name='rest_id' type='hidden' value='" .$rest_id."' />";
}else{
$is_sold = "<font color='green'>available</font><input name='ad1' type='checkbox' value='1'/><input name='rest_id' type='hidden' value='" .$rest_id."' />";
}
echo $rest_name." in ". $city." is ".$is_sold."<br />";
}
echo "</td><td><h2>Spot2</h2>";
How do I maintain the new checks or radio button selections while updating with ajax?
echo "<form name='mark_sold' action='mark_sold.php' enctype='multipart/form-data' method='post'><table width='1100' border='1'><tr><td><h2>Spot 1</h2>";
foreach ($rest_ids as $id){
//$rest_ids = implode("' or '", $rest_ids);
//$rest_ids = "'" . $rest_ids . "'";
$Get_Ad = mysql_query("SELECT rest_id, rest_name, city, ad_space1 FROM restaurant_info WHERE rest_id = $id");
$got_ad = mysql_fetch_assoc($Get_Ad);
$is_sold = $got_ad['ad_space1'];
$rest_id = $got_ad['rest_id'];
$rest_name = $got_ad['rest_name'];
$city = $got_ad['city'];
if($is_sold){
$is_sold = "<font color='red'>sold</font><input name='ad1' type='hidden' value='1' /><input name='rest_id' type='hidden' value='" .$rest_id."' />";
}else{
$is_sold = "<font color='green'>available</font><input name='ad1' type='checkbox' value='1'/><input name='rest_id' type='hidden' value='" .$rest_id."' />";
}
echo $rest_name." in ". $city." is ".$is_sold."<br />";
}
echo "</td><td><h2>Spot2</h2>";
How do I maintain the new checks or radio button selections while updating with ajax?