Re: Re[2]: [PHP] Newbie redirect/variable question
| From: | Jakob Kruse | Date: | Thu, 10 May 2001 14:22:41 +0000 |
| Subject: | Re: Re[2]: [PHP] Newbie redirect/variable question | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-52284@lists.php.net to get a copy of this message | ||
Well, that just means you have to rewrite the line:
header("Location: $HTTP_GET_VARS['fred']");
like this:
header("Location: " . $HTTP_GET_VARS['fred']);
But have you tried it with just $fred? You shouldn't have to use
$HTTP_GET_VARS.
Regards,
Jakob Kruse
""Steve Wade"" <swadie@zipworld.com.au> wrote in message
news:MABBKCBDLHPGCKNPPFEKOELJCFAA.swadie@zipworld.com.au...
> Thanks - hmm - doesn't seem to do it though.
>
> My current code is:
>
> <?php
>
> if ($HTTP_GET_VARS['fred'] != "") {
> # $statement = "UPDATE links SET hits=hits+1 WHERE href=\"$u\"";
> # mysql_query($statement);
> header("Location: $HTTP_GET_VARS['fred']");
> exit;
> } else {
> header("Location: $HTTP_REFERRER");
> exit;
> }
> ?>
>
> which gives an error msg:
>
>
> Parse error: parse error, expecting
T_STRING' or
> T_VARIABLE' or
> `T_NUM_STRING' in /home/swadie/public_html/redirect.php on line 6
>
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Steve Wade
> Youth Outreach Coordinator
> Fusion Australia Ltd (Sydney North)
> ABN 26 001 273 105
> +61 2 9477 1110
>
>
> -----Original Message-----
> From: Jakob Kruse [mailto:kruse@get2net.dk]
> Sent: Friday, 11 May 2001 0:00
> To: php-general@lists.php.net
> Subject: Re: Re[2]: [PHP] Newbie redirect/variable question
>
>
> You should probably urlencode the address first, like this:
>
> <a href="redirect.php?fred=<?php echo urlencode("www.fusion.org.au")
> ?>">test link</a>
>
> Not sure if it solves the problem though.
>
> Regards,
> Jakob Kruse
>
> ""Steve Wade"" <swadie@zipworld.com.au> wrote in message
> news:MABBKCBDLHPGCKNPPFEKEELHCFAA.swadie@zipworld.com.au...
> > Ahh - thanks - that's helped :-) (Line 9 was the http_referrer line)
> >
> > Now the only trouble is, it seems to still treat $fred as null.
> >
> > The passing line is from index.php:
> >
> > <a href="redirect.php?fred=www.fusion.org.au">test link</a>
> >
> > Should this work?
> >
> > Thanks,
> >
> > Steve
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > Steve Wade
> > Youth Outreach Coordinator
> > Fusion Australia Ltd (Sydney North)
> > ABN 26 001 273 105
> > +61 2 9477 1110