Re: Problem with VARIABLES
| From: | Hardy Merrill | Date: | Fri, 16 Mar 2001 18:26:52 +0000 |
| Subject: | Re: Problem with VARIABLES | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-44299@lists.php.net to get a copy of this message | ||
Ian, I think what you want is a variable variable - have a look at
http://www.php.net/manual/en/html/language.variables.variable.html
I think you might want something like this:
${$Color$Temp[$f]}
HTH.
--
Hardy Merrill
Mission Critical Linux, Inc.
http://www.missioncriticallinux.com
Ian LeBlanc [Ian@rask.com] wrote:
> I have this page where I am printing some items that are defined by size
> and color which all the info is pulled from a database.
>
> in the first item loop
> PRINT ("<td><input type=\"text\" name=\"$Color$Temp[$f]\"
size=\"3\"></td>\n");
> translated looks like this.
> <td><input type="text" name=\"WhiteS"
size="3"></td>
>
> meaning the color white and the size Small.
>
> Now the next loop does what it is suppose to and returns a value of
> <td><input type="text" name=\"BlackS"
size="3"></td>
>
> These get posted to the next page.
> Now for the PROBLEM
>
> without hard coding it how can I get the value of BlackS
> meaning I know the color and sizes but how do I put the variable together
> to print the value of it.
>
> On the 2nd page I would like to echo $Color$Temp[$f] but that does not
> return the value of the item.
> I need $Color$Temp[$f] to turn into the variable not a value. So I can echo
> the variable.
> Someone please help.
>
> (*NOTE* the reason I do not want to hard code it is that I have a list of
> 102 colors which makes for a really long script.)
>
> PLEASE CC ME ON THE MESSAGE BECAUSE I AM ONLY SUBSCRIBED TO THE DIGEST (I
> will have to wait some 12 odd hours for the answer)
> Regards,
>
> Ian LeBlanc
> Web Development
> Rask, Inc. - www.rask.com
> Phone: (727) 517-2000
> Fax: (727) 517-2001
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net