All I'm doing is making a hyperlink that sends the selected item from the
catalog to the add to shopping cart script. The code now looks like this...
$value = rawurlencode("add_to_cart.php?item_num=" . $item_num .
"&quantity=1&sale_price=" . $our_price .
"&unit=" . $unit .
"&short_d
You need to urlencode() selectively; in this case, only the
short_desc needs to be encoded, so you would have a statement
something like
echo
"add_to_cart.php?item_num=$item_num&quantity=$quantity".
"&sale_price=$sale_price&unit=$unit&short_desc=".
url_encode($short_desc)."&wholesaler=$whole
Oops...
-Forwarded Message-
From: Brad Pauly <[EMAIL PROTECTED]>
To: Joab Stieglitz <[EMAIL PROTECTED]>
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_t
> OK. I urlencoded the URL and now the URL passes correctly...
>
>
add_to_cart.php%3Fitem_num%3DSTT32700%26quantity%3D1%26sale_price%3D52.7
8%
> 26
>
unit%3DBX%26short_desc%3DENVELOPE%2C100%25COT%2024%23%2CGY%26wholesaler%
3D
> US
> %26cost%3D37.700
>
> ... but I get the following error:
>
> Fo
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 per
> For example, this URL:
>
> add_to_cart.php?item_num=SOU3432410&quantity=1&sale_price=24.92&unit=BX
> &short_desc=ENVELOPE,25%COT 24#,IY&wholesaler=US&cost=18.690
>
> gets cut off at the # sign, so $wholesaler and $cost come out empty.
>
> Any suggestions to get around this?
You could use urle
OK. I found the problem, and it isn't PHP or MySQL related. It's an HTML
problem. I'm passing the string from one script to another, and the # sign
is screwing up the URL.
For example, this URL:
add_to_cart.php?item_num=SOU3432410&quantity=1&sale_price=24.92&unit=BX
&short_desc=ENVELOPE,25%COT
> I have a MySQL database that includes data with the # sign in some
data
> fields. My PHP script pulls the data out of the database fine, but
when I
> got to write back to the database, I get errors because the string
gets
> truncated at the # sign. For example:
>
> $query = "INSERT IN
I have data that have #, so that is not the problem.
Show us more code AND your database structure.
- Original Message -
From: "Joab Ben Stieglitz" <[EMAIL PROTECTED]>
To: <>
Sent: Friday, January 17, 2003 2:25 PM
Subject: [PHP] Number Sign in String Variables
I
I have a MySQL database that includes data with the # sign in some data
fields. My PHP script pulls the data out of the database fine, but when I
got to write back to the database, I get errors because the string gets
truncated at the # sign. For example:
$query = "INSERT INTO order_det
10 matches
Mail list logo