I'm trying to pass some things in a query string from an html page to a php page, specifically a number (n) and a text phrase (question) -
<script language="JavaScript">
<!--
function viewfeatured(n, question) {
window.open('http://www.url.com/comments.php3?' + n + '%%' + question, 'comments' + n, 'directories=0,height=400,location=0,resizable=1,scrollbars=1,toolbar=0,width=430');
}
//-->
</script>
This is called from the page like this:
<a href="javascript:viewfeatured(0, 'When did you know you were home?');">link</a>
On my PHP page, I need it to do 2 things:
Grab just the number (n) before the delimiter %%, regardless of if it is 0 or 1042 (it can't just use a substr and grab whatever the start and length parameters are... it needs to grab everything before the delimter) and return it as a variable.
Grab the question (question) after the delimiter %% and return it as a variable as well. It also needs to strip off the %20 tags that Internet Explorer throws in there in between the words.
This is what I have thus far for the number:
$badcommentID = str_replace("%20", " ", getenv('QUERY_STRING'));
$commentID = ereg_replace('[0-9]', '', $badcommentID);
but this grabs any number that might also be in the question...
Any help would be greatly appreciated.