Forum Moderators: coopster

Message Too Old, No Replies

String cut short b/c includes quotes

         

briesm

5:09 pm on Jun 13, 2005 (gmt 0)

10+ Year Member



Hey all. I'm using a hidden field to send along information on a product in a form. Because I want it to all be on one line, I have a short name for it and value includes a bunch of information regarding the product. But for some reason, "Description" is always cut short when double quotes appear in it. The variable is set to:
6"H HALF-SIZE SOLID BOTTOM SEALED CONTAINER
Yet all that ever displays is 6
The ordersArray is just an array of strings. The last one always corresponding to descriptions.
Descriptions fields often include numerous double quotes for measurements. I know this could prolly be solved with a string replace, but i've fiddled with that and can't seem to get it.

Here is the code:

echo '<input type="hidden" name="Order ';
echo $orderNumber;
echo '" value="';
echo 'Qty: ';
echo number_format($ordersArray[$itr]);
echo ' Part ID: ';
echo $ordersArray[$itr+1];
echo ' Unit: ';
echo $ordersArray[$itr+2];
echo ' Unit Price: $';
echo number_format($ordersArray[$itr+3],2);
echo ' Subtotal: $';
echo number_format($ordersArray[$itr+4],2);
echo ' Description: ';
echo $ordersArray[$itr+5]);
echo '">';

dreamcatcher

7:04 pm on Jun 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi,

You need to convert the quotes to character entities. ie: " > &quot;

Take a look at htmlspecialchars().

[uk.php.net...]

dc

briesm

7:26 pm on Jun 13, 2005 (gmt 0)

10+ Year Member



Aha! Thank you very much :)