0v3k Shi3ld3r 0v3k Shi3ld3r - 1 year ago 81
PHP Question

Correctly Formatting URL with variable(s)

I have the following line below as a URL


I would like replace cid & tid for the below values

$topic_tid= $row->cat_id;

$topic_id= $row->id;

I have tried the following (Not Working)

echo "<a href=view_topic.php?cid=".$topic_id."&tid"=.$topic_tid.">Result</a>";

How can I correctly format the above line please

Answer Source

You should use proper quotes (single) for href assign and proper content in "&tid=" (missing = .. your is outside the string)

echo "<a href='view_topic.php?cid=".$topic_id."&tid=".$topic_tid."'>Result</a>";
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download