Hi,
I have a php page where I output a list of titles and give the option to delete them. When the user clicks on delete, I call the following JavaScript function:
function deleteitem(title) {
if (confirm("Are you sure you want to delete '" + title +"'"))
{
window.location.href = 'outputadmin.php?del=' + title;
}
}
If the user confirms, then the title is deleted from the database. Everything works as long as I don't have a title that contains the '&' (ampersand) character. For example, if I have the following title: 'John & Mary', then after the user confirms his wish to delete, the following url will be sent: outputadmin.php?del=John&Mary
The problem is that when I access $GET I will get $GET=John and that's not the title in the database. I know 'Mary' is treated as separate variable just like 'del'.
Is there a way around this in JavaScript to urlencode the whole title? In other words, to skip the '&'?
Thank you very much.
Best,
Mike