Forum Moderators: coopster
cal.php
room_type
--------
ensuite
ensuite
single
single
book.php : Output:
single single
it is not printing out ensuite...any idea?
cal.php------------------------------------------------
if($qty!== '0'){
$p=0;
while($fday<$tday){
echo "<td>$room_Type<input type='text' name='room_Type_break' value='$room_Type'></td>
$p++;
}
echo "<input type='hidden' name='count' value='$p'>"; }
book.php--------------------------------------------------
for ($i = 0; $i <= $_POST['count']; $i++) {
$room_Type_break = $_REQUEST['room_Type_break_'.$i.''];
echo "$room_Type_break";
}
Try adding this to book.php and tell me what you are getting:
echo '<pre>';
print_r($_REQUEST);
echo '</pre>';
It seems as though there is something on the previous page that is not allowing the information to be sent via the form correctly, or you aren't handling the info on book.php correctly. The code above will let us know that everything is being sent to the action page correctly.
thanks for you reply...i managed to solve it using foreach loop...
:)
Problem after problem....now i am trying to insert into table using foreach loop...anyidea?
for e.g.
$query = mysql_query("INSERT INTO people (name)VALUES ('$name')")or die(mysql_error());
--------------------------------------------------------
foreach($names as $name){
echo "$name";
}
how do i now insert using foreach loop?
It looks like you are using MySQL, but no matter which database you are using, never trust the user-supplied data. Edit it first to make sure it contains data you expect, and then escape it or use prepared statements.
"INSERT INTO customerbook (booking_ID,room_Type)
values((select booking_ID from bookings where booking_ID = bookings.booking_ID),'$a')"
any solution?
output should be like this:
ID Type
1 single
1 ensuite
i am new to php...can you tell me plz how the above code should be done?