Re: Variable question, yet another
| From: | Jason Stechschulte | Date: | Tue, 08 May 2001 19:22:44 +0000 |
| Subject: | Re: Variable question, yet another | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-51960@lists.php.net to get a copy of this message | ||
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>