Re: Re: Forms in PHP

From: Date: Fri, 12 Apr 2002 16:42:05 +0000
Subject: Re: Re: Forms in PHP
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-92790@lists.php.net to get a copy of this message
On Fri, Apr 12, 2002 at 09:36:42AM -0700, Andrew Chase wrote: : : foreach(array_keys($menu_options) as $option_value){ : $option_text = $menu_options[$option_value]; : echo '<OPTION VALUE="$option_value">$option_text</OPTION>'; : } : : would just output : : <OPTION VALUE="$option_value">$option_text</OPTION> : <OPTION VALUE="$option_value">$option_text</OPTION> : <OPTION VALUE="$option_value">$option_text</OPTION> : : which is probably not the desired output :) You need to use double quotes : for variable substitution. Unfortunately, if you want to maintain XHTML : compliance the tag attributes have to be double-quoted too... : : echo "<OPTION VALUE=\"$option_value\">$option_text</OPTION>\n"; Why stick with quotation marks? echo "<OPTION VALUE='$option_value'>$option_text</OPTION>\n"; -- Eugene Lee eugene@fsck.net

« previous php.general (#92790) next »