0v3k Shi3ld3r 0v3k Shi3ld3r - 3 months ago 5
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


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>";