Notice: Unidentified index

Hello,
I have a question that nobody can answer. So I am hoping you could shed some light on my situation!
This is the code: [php]
echo (’

Choose an option
<2000 DDK
2000 - 2500 DDK
2500 - 3000 DDK
3000 - 3500 DDK
3500 - 4000 DDK
>4000 DDK


');

$chose = $_GET[‘chose’];
if ($chose == ‘2500-3000’)
{$sql = “SELECT Dorm Name,Price per Month,Link,From,Info \n”
. “FROM results \n”
. “WHERE Price per Month < 3000 and Price per Month > 2500”;
echo $sql;}
else {
echo (‘no go here!’);
}
[/php]

The problem is that the index ‘chose’ does not get recognized. How do I fix that?

Because it’s not defined until you actually hit the Submit button…

You should do something like this, if it’s set use it, if not set it to blank.

Change:

[php]$chose = $_GET[‘chose’]; [/php]

to

[php]$chose = isset($_GET[‘chose’]) ? $_GET[‘chose’] : ‘’;[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service