Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

php # character problem

Status
Not open for further replies.

dessie1981

Programmer
May 9, 2006
116
GB
Hi Guys,

Having a bit of a problem with the online store i have built wondering can anybody help me.

Anyhow i am returning a part number from the mysql db and using this part number to reference the file name of the pic to be displayed, the file names have corresponding product part no's ensuring that that i return the correct pic for the correct product.

This works fine for me except when there is a "#" character in the part number,

Is this a php problem, don't think it is a mysql prob because when i run the query from the command line i return the correct result.

Anyone any ideas,

Dessie
 
Thanks,

But is still not working after using the htmlentities function ,
When i return the product code from the db everything after the # character is not being returned, it is on the command line however when i return the part no to a browser screen everything after the hash character is not printing.

e.g if part number is 3859#EG65K

im only getting 3859
I think php is stripping everything after the hash for some reason.

How would you recommend writing a translation table.


Dessie
 
I don't know if this will help, but looks like you're passing the part number information via the address bar. Since # is a reserved character in the address bar, it will be interpreted as an anchor reference on the page -- your browser will be pointing to an element with an id of EG65K. In order to let the browser know that # is not an anchor reference but part of the variable, I think you would need to encode your url value with urlencode().
 
Hi again,

Thanks for the help , I ended up giving each partno a unique id in the db and passed that instead, you were right the # was being interpreted as an anchor,

Thanks again

Dessie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top