[Fwd: Re: [PHP] Number Sign in String Variables]
| From: | Brad Pauly | Date: | Sat, 18 Jan 2003 23:50:45 +0000 |
| Subject: | [Fwd: Re: [PHP] Number Sign in String Variables] | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-132138@lists.php.net to get a copy of this message | ||
Oops...
-----Forwarded Message-----
From: Brad Pauly <brad@robinsontech.com>
To: Joab Stieglitz <jstieglitz@st-i-e-g.org>
Subject: Re: [PHP] Number Sign in String Variables
Date: 18 Jan 2003 16:40:40 -0700
> OK. I urlencoded the URL and now the URL passes correctly...
>
> add_to_cart.php%3Fitem_num%3DSTT32700%26quantity%3D1%26sale_price%3D52.78%26
> unit%3DBX%26short_desc%3DENVELOPE%2C100%25COT%2024%23%2CGY%26wholesaler%3DUS
> %26cost%3D37.700
>
> ... but I get the following error:
>
> Forbidden
> You don't have permission to access
> /carmae/add_to_cart.php?item_num=STT32700&quantity=1&sale_price=52.78&unit=B
> X&short_desc=ENVELOPE,100%COT 24#,GY&wholesaler=US&cost=37.700 on this
> server.
Your web server is trying to find a directory with that long name. If
you encode the entire string, you need to pass it in a new variable,
then break it apart again.
> Suggestions?
Sorry, I gave some bad advice the first time. All you need to do is
urlencode each of the variables individually. Something like this:
$item_num_encoded = urlencode($item_num);
[...]
Then your link will be something like this:
add_to_cart.php?item_num=$item_num_encoded
Brad