php - Javascript & problems -
i have following code:
var artist = document.getelementbyid("txtboxartist").value; when value plain text, e.g. biffy clyro, artist = biffy clyro
when value contains &, e.g. mumford & sons, artist = mumford
i send artist value using ajax, , recover value on php page this:
var data = "nametitle=" + title + "&nameartist=" + artist; [...]
$nameartist=$_post['nameartist']; why happen , how avoid it? giving me lots of problems &symbol...
thank all!
i guess can encode valiables before sending them this:
artist = encodeuricomponent(artist); title = encodeuricomponent(title); var data = "nametitle=" + title + "&nameartist=" + artist; hope helps.
Comments
Post a Comment