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" <[EMAIL PROTECTED]>
To: "King, Justin" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
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
> [EMAIL PROTECTED]
> --
> The whole history of computers is rampant with cheerleading at best and
> bigotry at worst.
>              -- Larry Wall in <[EMAIL PROTECTED]>
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to