Hi,
I am using a form to capture user input. I have noticed that if the user includes the '&' sign in an input string in causes a termination of the data string which is sent to the target script.
For example if the input was: "This is a test of the & sign"
The variable receiving this string would read as: "This is a test of the"
Is it first necessary to encode the string?
Thanks in advance,
Rob.
Form string with '&' sign
Moderator: General Moderators
-
spacebiscuit
- Forum Contributor
- Posts: 390
- Joined: Mon Mar 07, 2005 3:20 pm
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
Re: Form string with '&' sign
The browser will read it literally is an "&" operator and not &
So you should encode it.
So you should encode it.
-
spacebiscuit
- Forum Contributor
- Posts: 390
- Joined: Mon Mar 07, 2005 3:20 pm
Re: Form string with '&' sign
Ok thanks, is there a function available to do this?
Thanks,
Rob.
Thanks,
Rob.
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
Re: Form string with '&' sign
urlencode to encode it and urldecode to decode it.
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
Re: Form string with '&' sign
Each to their own. There is never a "correct" one only a wrong one 
Re: Form string with '&' sign
aceconcepts wrote:Each to their own. There is never a "correct" one only a wrong one
Oops!
For some reason I thought you were talking about JavaScript, I read escape & unesacpe.
-
spacebiscuit
- Forum Contributor
- Posts: 390
- Joined: Mon Mar 07, 2005 3:20 pm
Re: Form string with '&' sign
Thaks that has solved the problem.
Rob.
Rob.