Re: Variable question, yet another
| From: | Gyozo Papp | Date: | Wed, 09 May 2001 10:43:34 +0000 |
| Subject: | Re: Variable question, yet another | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-52073@lists.php.net to get a copy of this message | ||
put the array indices in single quote like :
echo "[a href=\"myscript.php?username={$userdata['username']}\"]Goto
MyScript.php[/a]";
----- Original Message -----
From: "Jason Stechschulte" <jpstech@unoh.edu>
To: "King, Justin" <KingJ@superior.k12.wi.us>
Cc: <php-general@lists.php.net>; <de@kracked.com>; <crowe@lit.org>
Sent: 2001. május 8. 21:22
Subject: Re: [PHP] Variable question, yet another
> On Tue, May 08, 2001 at 01:20:49PM -0500, King, Justin wrote:
> > So when the line hits type 1, it evals like this
> >
> > echo "[a
> > href="myscript.php?username={$userdata["username"]}"]Goto
> > MyScript.php[/a]";
> >
> > Of course this yields an error because of the "'s in the anchor tag.
> > But if I add slashes the evaluated code will be
> >
> > echo "[a
> > href=\"myscript.php?username={$userdata[\"username\"]}\"]Goto
> > MyScript.php[/a]";
>
> Why not just break out of the string to print the username?
> echo "[a
> href=\"myscript.php?username=".$userdata["username"]."\"]Goto
> Myscript.php[/a]";
>
> --
> Jason Stechschulte
> jpstech@unoh.edu
> --
> The whole history of computers is rampant with cheerleading at best and
> bigotry at worst.
> -- Larry Wall in <199702111730.JAA28598@wall.org>
>
> --
> 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
>