Jump to content

please help! global_registers off converting code


CaptainJ

Recommended Posts

Hi,
I'm a newbie to php and slowly learning....i have the code listed below and im getting the following error:
[b]Notice [code=php:0]: Undefined variable: display_block in file

Is this error because global registers are off? (If so I'd like to keep it off)...Can anyone give me any help in what I can do to correct the error?

Many many thanks!! I've been scouring the internet and driving myself crazy.....



Code Snippet:

$get_states = "SELECT distinct city FROM theater_addresses where
state like \"%$trimmed%\" order by city";
$get_states_res = mysql_query($get_states) or die(mysql_error());
if (mysql_num_rows($get_states_res) > 0) {

$display_block .= "<select name=\"c\">
<option value=\"\">-- Select One --</option>
<option value=\"Other\">Other</option>";

while ($states = mysql_fetch_array($get_states_res)) {
$state = $states['city'];

$display_block .= "<option value=\"$state\">$state</option>";
}
$display_block .= "</select>";
}
}
?>

</font><ul><ul><p>
<center><form name="theaters" action="Review_Theater_12.php" method="get">

<? print $display_block;  ?>
<p><font color="black" size="2" face="Textile"></font></p><p><font size="2" face="Courier
New,Courier,Monaco"><button type="submit" name="TheaterSearch">Next</button>
</p></ul></ul><p></p>
</form></center>/font></center>
Is "$display_block" used before this statement:
[code]<?php
$display_block .= "<select name=\"c\">
<option value=\"\">-- Select One --</option>
<option value=\"Other\">Other</option>";
?>[/code]

If not, that's where the notice is coming from. Change the ".=" to a plain "=".

Also, it looks like you misspelled "$display_block" and "$display_blockk" in this statement:
[code]<?php
$display_blockk .= "</select>";
?>[/code]

Ken

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.