Skip to main content
Inspiring
November 3, 2006
Question

php print question

  • November 3, 2006
  • 11 replies
  • 391 views
Hi all............

I'm using the code below to populate a field in my enquiry form.
The problem is that some of the product names have characters such as & and
+ in the names and these are not showing.
So for instance, if a product has the name of "D+144 with 1&2 phase" the
product name would show as "D144 with 1"

Any ideas how i can get round this problem???

Thanks
Andy


<?php $_GET["product"]; ?>

<?php print $product; ?>


This topic has been closed for replies.

11 replies

Inspiring
November 3, 2006
Andy wrote:
> I'm using the code below to populate a field in my enquiry form.
> The problem is that some of the product names have characters such as & and
> + in the names and these are not showing.
> So for instance, if a product has the name of "D+144 with 1&2 phase" the
> product name would show as "D144 with 1"

It's got nothing to do with PHP, but with the way that you are passing
values through the query string. Anything passed through a query string
needs to be URL encoded. Forms should do this automatically, but if
you're getting the information from elsewhere, you need to pass it to
urlencode() before sending it through the get method.

--
David Powers
Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
http://foundationphp.com/