Topic awaiting preservation: PHP problems with interoreting $ sign as a siring character (Page 1 of 1) |
|
---|---|
Bipolar (III) Inmate From: |
posted 09-11-2004 10:57
I'm passing variables from one form to a php page. At times a user may enter the $ sign in the textboxes on the form but when it gets to the php page its interpolated as a variable instead of a character in a string. What string function do I use to ensure that the contents being posted from my form are ALL interpreted as characters. |
Maniac (V) Mad Scientist From: :morF |
posted 09-11-2004 13:17
run your string through a str_replace() function, searching for $ and replacing it with \$ |
Paranoid (IV) Mad Scientist with Finglongers From: Germany |
posted 09-11-2004 14:20
may I inquire what are you doing with the form data? calling eval on it? |
Maniac (V) Mad Scientist From: Rochester, New York, USA |
posted 09-11-2004 15:44
That is the only way I could see the data being interpereted as a real variable. You should never call eval on user submitted data, especially if you don't know how to make sure that all of your data is valid. |