CaptainJ Posted January 14, 2007 Share Posted January 14, 2007 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 wherestate 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="CourierNew,Courier,Monaco"><button type="submit" name="TheaterSearch">Next</button></p></ul></ul><p></p></form></center>/font></center> Link to comment https://forums.phpfreaks.com/topic/34096-please-help-global_registers-off-converting-code/ Share on other sites More sharing options...
kenrbnsn Posted January 14, 2007 Share Posted January 14, 2007 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 Link to comment https://forums.phpfreaks.com/topic/34096-please-help-global_registers-off-converting-code/#findComment-160349 Share on other sites More sharing options...
CaptainJ Posted January 14, 2007 Author Share Posted January 14, 2007 that worked!!! thank you so much!!! :D Link to comment https://forums.phpfreaks.com/topic/34096-please-help-global_registers-off-converting-code/#findComment-160359 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.