Hello all, I'm trying to build a forum site. The code below works fine but I dont know how to catch it from the address bar. I'm having trouble finding tutorials to help me with this.

viewtopics.php

echo "<tr bgcolor='#6698FF' ><td><a href='viewcomments.php?id=".$rows['topic']."'>
".$rows['topic']."</a></td><td>".$rows['username']."</td><td>".$rows['timestamp']."</td></tr>";

Address Bar

http://localhost/testsite/viewcomments.php?id=Cowboys%20Dancehall

I'm trying to use this in code below in viewcomments.php to retrieve the address info

$id = $HTTP_GET_VARS['topic'];

I'm getting this error
"Notice: Undefined variable: HTTP_GET_VARS in C:\wamp\www\testsite\viewcomments.php"

Recommended Answers

All 4 Replies

Member Avatar for diafol

EEK! Which version of PHP are you using? I thought HTTP_GET_VARS was T_REX's extinct cousin.

lol.... perhaps thats why it's not working. What alternative coding should I replace it with?

if you wnat to get the id value from the address bar, try this

$id=$_GET['id']

Thank you!! Solved!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.