it returns
Array
(
)
unidentified index....
ya, but if you select combobox then click on generate
Result if you selected single room:
Array
(
[room] => single room
)
room type : single room
just a drop of dew in the morning
( loop while (= x true) do (x) )
aw... my rooms are connected to the database...
try this :
if you access it for first time, $mode is not assigned. use isset to determine whether $mode has a value or notCode:<?php
if (isset($_GET["room"])) {
$username = "root";
$password = "";
$host = "localhost";
$database = "h_reservation";
$connection = @mysql_connect($host, $username, $password) or die("Can not connect to database: ".mysql_error());
$db = @mysql_select_db($database) or die("Can not select the database: ".mysql_error());
$mode = $_GET["room"] ;
echo "<h3> room type : $mode </h3><hr>";
//DISPLAYING CONTENT!!
$select = mysql_query("SELECT * FROM guest_info where room_type = '$mode'");
if (!$select) {
echo mysql_error();
}
$total = 0;
while($row = mysql_fetch_assoc($select)){
echo "guest id : ". " " . $row['guest_id']
. $row['room_type'] . "<br>"
. " " . $row['check_in'] . " " . "to" ." "
. " " . $row['check_out']
. "<br>" . "<br>";
$total = $total + 1 ;
}
echo "<hr>";
//COUNTING CONTENT
echo "<h1>-----------------total number of reservation-----------------------</h1>" . "<br>" . "<br>";
echo "<h1> $total </h1><hr>";
}
?>
just a drop of dew in the morning
( loop while (= x true) do (x) )
do you know how to makehave a value after loading? i think thats the problem.. because when $mode does have value the unidentified dissapears..Code:$mode = $_GET["room"] ;
I've tried your code, my friend. There is no error I found. $mode have a value after loading.
I think the problem is not about the code. Maybe error because environment you work with.
I don't have clue anymore
just a drop of dew in the morning
( loop while (= x true) do (x) )
me too... i dont know whats the problem because i dont see any... except for that unidentified index...anyways thanks for the help really appreciate
![]()
I think you have problem with server, what server you used?
just a drop of dew in the morning
( loop while (= x true) do (x) )
There is no error, there is a warning. Depending on your servers php configuration, it may display warnings, or it might not. Most servers hide warnings. The warning is generated because when the page first loads $_GET['mode'] does not exist (and therefore undefined). It is defined (or is set) _after_ you submit the forum. As abdul.gafur suggested in post #14, you may use isset to test if a variable exists (note how this is different from checking if a variable has a value which will generate the warning you are seeing).
im using wamp server..![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks