Problems with echo statement
I am having an issue with an echo statement.
I am passing a string with $_GET and attempting to print it with echo. The issue is the content in the $_GET contains an & and when I echo the string it doesnt print the & or anything after it. For example,
the url which is sending the information is
I have tried just echoing the $_GET['subject']. I have also tried running it through htmlspecialchars(). I have also tried replacing the & with regrex but nothing seems to work.
Whenever I print out the variable it is turned from "Kim & Kanye! Will it last?" into "Kim"
Can anyone figure out why it is doing this?
Either use htmlspecialchars() or htmlentities() on the text being output.
Tried htmlspecialchars, ended up with the same effect. Thats what I thought would fix the problem as well.
We may need to see a bit of the actual PHP code to better understand what you are trying to do. Maybe it's just a case of a HTML tag attribute's value not being quoted?
Figured it out. Just needed to add urlencode() to the variable before it was passed via $_GET. That allows the & to get passed and then I used htmlentitites() on the receiving end before echoing.
Can you post a tidbit of the code and I may be able to help you!
plz attach your code and i may be able to help u
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)