Filth wrote:[color=blue]
>
> Hi
>
> this is probably very easy to sort but I want to do the following:-
>
> header( "Location:
> subscribe_form.php?name='.$_GET['name'].'&email='.$_GET['email'].'");
>
> but this pulls up the error:-
>
> Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting
> T_STRING or T_VARIABLE or T_NUM_STRING in
> /home/httpd/vhosts/promotingmusic.co.uk/httpdocs/test/subscribe.php on line
> 11
>
> the above being line 11. How would I go about encoding the URL properly. The
> reason I am doing this is that I am using a form that is being validated via
> another script and if there is a problem I wish to fiorward them back to the
> form with it pre filled in.[/color]
A few problems:
Always url_encode your variables when they're in a header. Otherwise, if you
have a space or another invalid character you'll get an error.
You should use absolute URLs in the location header. Some browsers do not
support relative URLs.
Single and double quotes aren't interchangable (I assume you don't want single
quotes in the email and name variables).
Always close your quotes.
header( "Location:
http://yourdomain.com/script.php?name=".url_encode($_GET['name'])."&email=".urlencode($_GET['email']));
Regards,
Shawn
--
Shawn Wilson
shawn@glassgiant.com http://www.glassgiant.com