Posted by Leszek on 01/31/06 17:39
Here is how
$dane = array ();
$wynik2=mysql_query($hotel_query2);
while($wiersz2=mysql_fetch_array($wynik2)){
$dane[$idhotelu]['room'][] =$wiersz2[0];
$dane[$idhotelu]['price'][] =$wiersz2[1];
$dane[$idhotelu]['nrooms'][]=$wiersz2[2];
}
$k=-1;
foreach ($dane[$idhotelu]['room'] AS $room) {
$k++;
$dane[$idhotelu]['zamow'][$k]=0;
}
I have problem - how to acces multidimesional array to get a value from it.
The problem is this fragment:
echo"<td align=\"center\" width=\"300\"><b><select
name=\"\$dane[$idhotelu]['zamow'][$k]\">";
for($i=0;$i<=$nrooms;$i++)
{
echo "<option value=\"$i\"";
if($_POST[$dane[$idhotelu][\'zamow\'][$k]]==$i){ //this is
only true for $i=0
ted";
}// endif
echo">$i</option>\n";
}//endfor
echo"</b></select></td>";
Here what im getting from print_r($_POST)
[$dane] => Array
(
[1] => Array
(
[\'zamow\'] => Array
(
[0] => 1 // this value is 1 so why
if($_POST[$dane[$idhotelu][\'zamow\'][$k]]==$i)
) // is true for $i=0 ?
)Can anyone tell me what should be instead of
if($_POST[$dane[$idhotelu][\'zamow\'][$k]]==$i)
to make it work properly?
Thanks
Leszek
[Back to original message]
|