Hi, I'm trying to pass a new value to the table - I have added bookingID and have this passed through my booking sequence with no probs - However - I can't seem to pass this value to the sql table when I click on a day to add -
Cheers
<input type="hidden" id="bookingID" name="bookingID" value="<?php echo $_POST["bookingID"]; ?>">
id_booking=document.getElementById('bookingID').value;
var the_url=update_url+"?id_item="+id_item+"&the_date="+the_date+"&special_state="+special_state;
var the_url=update_url+"?id_item="+id_item+"&the_date="+the_date+"&special_state="+special_state+"&id_booking="+id_booking;
$insert="INSERT INTO ".T_BOOKINGS." SET id_item='".$_REQUEST["id_item"]."', the_date='".$_REQUEST["the_date"]."', state='".$_REQUEST["special_state"]."', bookingID='".$_REQUEST["bookingID"]."'";
ajax_mod_state(\''.$id.'\',\''.$this_date.'\',\''.$day_counter.'\',event, \''.$bookingID.'\')
function ajax_mod_state(id_item,the_date,the_num,e,id_booking){
$booked_days = array();
$sql="SELECT * FROM ".T_BOOKINGS." WHERE id_item=".ID_ITEM."";
if(!$res=mysql_query($sql)) die("ERROR checking id item availability dates<br>".mysql_error()."<br>".$sql);
while($row=mysql_fetch_assoc($res)){
$booked_days[$row["the_date"]]=array("state"=>$row["state"], "id_booking"=>$row["id_booking"]);
}
$booked_days = array();
$sql="SELECT * FROM ".T_BOOKINGS." WHERE id_item=".ID_ITEM."";
if(!$res=mysql_query($sql)) die("ERROR checking id item availability dates<br>".mysql_error()."<br>".$sql);
while($row=mysql_fetch_assoc($res)){
$booked_days[$row["the_date"]]=array("state"=>$row["state"], "id_booking"=>$row["id_booking"]);
}
if(array_key_exists($this_date,$booked_days)){
//echo "<br>".$booked_days[$this_date];
if($booked_days[$this_date]=="am") $day_image='cal_am_'.$day_counter.'.png';
elseif($booked_days[$this_date]=="pm") $day_image='cal_pm_'.$day_counter.'.png';
elseif($booked_days[$this_date]=="prv") $day_image='cal_prv_'.$day_counter.'.png';
else $day_image='cal_on_'.$day_counter.'.png';
}
if(array_key_exists($this_date,$booked_days)){
//echo "<br>".$booked_days[$this_date];
if($booked_days[$this_date]["state"]=="am") $day_image='cal_am_'.$day_counter.'.png';
elseif($booked_days[$this_date]["state"]=="pm") $day_image='cal_pm_'.$day_counter.'.png';
elseif($booked_days[$this_date]["state"]=="prv") $day_image='cal_prv_'.$day_counter.'.png';
else $day_image='cal_on_'.$day_counter.'.png';
}
if($show_link==1){
$day_link_start ='<a href="#" onclick="ajax_mod_state(\''.$id.'\',\''.$this_date.'\',\''.$day_counter.'\',event); return false" title="'.$lang["modify_availability_for"].' '.$lang["day_".$week_day.""].' '. $date_format.'" class="cal_day">';
$day_link_end ='</a>';
}else{
$day_link_start ="";
$day_link_end ="";
}
// default NO link state for all dates
$day_link_start ="";
$day_link_end ="";
$day_alt =$lang["days"][$week_day].' '. $date_format;
// show ajax link or not
if($booked_days[$this_date]["id_booking"]>0){
// date with idbooking - NO link
// you could also define diferent style here to "highlight" the dates
$date_alt = $lang["day_".$week_day.""].' '. $date_format.' booked - id: '.$booked_days[$this_date]["id_booking"];
}
elseif($show_link==1)
{
$date_alt = $lang["modify_availability_for"].' '.$lang["days"][$week_day].' '. $date_format;
$day_link_start = '<a href="#" onclick="ajax_mod_state(\''.$id.'\',\''.$this_date.'\',\''.$day_counter.'\',event); return false" title="'.$date_alt.'" class="cal_day">';
$day_link_end = '</a>';
}
<span id="state_'.$this_date.'">
<img src="'.DIR_IMAGES.''.$day_image.'" alt="'.$date_alt.'" title="'.$date_alt.'" border="0" width="20" height="20">
</span>
if($booked_days[$this_date]["id_booking"]>0){
Users browsing this forum: No registered users and 2 guests