Passing php variable to javascript location.href

Hi, new at all this…

I’ve got a form that submits to its own page using $PHP_SELF

It submits data to the db, then throws up a javascript alert that says thank you, then redirects using location.href

Problem is that I want to put a php variable on the end of the url, but I can’t figure out how to pass it into the Javascript.

alert(‘Thank you. Posting has been edited.’);
location.href = “index.php?edit=Y&s=$variable”;

I know its something stupid but I can’t figure it out. Thanks in advance for any help


echo "<script type=\\"text/javascript\\">
alert('Thank you. Posting has been edited.');
location.href = \\"index.php?edit=Y&s=$variable\\";
</script>";

Knew it had to be something simple like that.

Thanks for the quick response