Re: Array with $ problem
| From: | A. Gent | Date: | Sat, 14 Oct 2000 00:22:04 +0000 |
| Subject: | Re: Array with $ problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-20109@lists.php.net to get a copy of this message | ||
Matt,
It looks like it's static - but it isn't. What you see
is actually the result of a SQL query, formatted the
exact way as a class needs it - with double quotes -
to build dynamic drop down lists on a form.
Regardless, the single quote is not a bad idea
otherwise.
Thanks.
Art
> > You can do it, but you'll need to use "eval()".
> It would look a little
> > like this...
> >
> > <?
> > $middle = " \"TYPE\"=>\"select\",
> > \"NAME\"=>\"sex\",
> > \"SIZE\"=>1,
> > \"VALUE\"=>\"NULL\",
> > \"OPTIONS\"=>array(
> \"NULL\"=>\"Please Select\",
> >
> \"M\"=>\"Male\",
> >
> \"F\"=>\"Female\"),
> >
> \"ValidationErrorMessage\"=>\"Must select sex\" ";
> >
> > eval("\$aArray = array($middle);");
> >
> > $subscription->AddInput($aArray);
> > ?>
>
> Am I the only one that finds all those escaped
> quotes completely
> unsightly? Why bother with it, when that whole
> thing is static content?
>
> Change the outermost quotes to single quotes, and it
> will look much
> cleaner.
>
> Matt
__________________________________________________
Do You Yahoo!?
Get Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/