Page 1 of 1

[b]Trying to grab "?what=ever" from query url[/b]

Posted: Fri Jun 20, 2003 2:15 am
by jimrains
Trying to grab "?what=ever" from query url

How can I from client side "page.htm" link to server side "adid.php" and make the var "$adid" and it's value usable in "page.htm"? Trying to grab
"?adid=???" from linking url without using cookie.

page.htm
<html><head></head>
<body>
<a href=........
or
<script language=javascript.......
or
<how ever.......

</body></html>


adid.php
<html><head>
<?php
$adid=$_GET['adid'];
?>
</head><body>
</body></html>


Thanks for your help to a real newbie!!

Posted: Fri Jun 20, 2003 6:08 am
by m@ndio
jimrains,

in your page.htm simply setup a standard hyperlink but with a query on the end like so:

<a href="adid.php?adid=test123">example</a>

now in your adid.php add an extra line in your php to display the value you parsed like so:

Code: Select all

<?php 
$adid=$_GET['adid']; 
echo $adid;
?>
hope this helps

Posted: Fri Jun 20, 2003 10:37 am
by jimrains
Thanks, let me re-phrase my question. From an client side .htm how do I grab url variables? (ie: -http://anypage.com?adid=100). Need to use php on server side.

Maybe what I'm trying to do can't be done.

Thanks :? :?

Posted: Fri Jun 20, 2003 12:05 pm
by m@ndio
hi,

I am a bit confused do you mean that you want to parse variables to html files like this?

http://www.domain.com/test.htm?adid=test123

please clarify jim.

Posted: Fri Jun 20, 2003 8:47 pm
by jimrains
Yes. Let's say my main web page is, from your example ../test.htm. I need ?adid=test123 accessiable to../test.htm. I understand I have to use server side code to parse the variable ?adid=test123, what I do not understand is how to make ?adid=test123 accessiable to ../test.htm.

I'm such a newbie at all of this I hope I'm not confusing you even more.