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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jimrains
Forum Newbie
Posts: 3
Joined: Fri Jun 20, 2003 2:15 am
Location: USA - florida

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

Post 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!!
User avatar
m@ndio
Forum Regular
Posts: 163
Joined: Fri Jun 06, 2003 12:09 pm
Location: UK

Post 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
jimrains
Forum Newbie
Posts: 3
Joined: Fri Jun 20, 2003 2:15 am
Location: USA - florida

Post 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 :? :?
User avatar
m@ndio
Forum Regular
Posts: 163
Joined: Fri Jun 06, 2003 12:09 pm
Location: UK

Post 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.
jimrains
Forum Newbie
Posts: 3
Joined: Fri Jun 20, 2003 2:15 am
Location: USA - florida

Post 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.
Post Reply