This question already has an answer here:
- How to escape quotes in PHP? [closed] 4 answers
i am allowing users to submit data into my website.
This data will more than likely contain html markup generated by forums. The problem is, some forums use "" for some attributes and then use '' for others.
If the user enters this, it will break my PHP code as i assign this entered text to a variable.
I am using HTMLPurifier on this string.
Is there a way to allow a mixture of "' inside a php string?
e.g:
$text = "This is an image <img src='imagelink' alt="imagetext">";
Wouldn't work. But its what i receive sometimes.
Whilst im at it, what is the correct term for " & ' when giving a value to a attribute?
Craig.
</div>