hey all,

Just a quick one (I hope). I've only ever really done this as a button from something simple like a drop down box.

I have a table which is populated by a mysql db:

echo "<table class=\"gridtable\" cellpadding=\"0\" cellspacing=\"0\">
<th>Vacancy Type</th>
<th>Learning Provider</th>
<th>Contact Details</th>



    echo'<td>'. nl2br($row['ContactDetails']).'</td>';  


echo "</table>";

Heres my question, I want to be able to hyperlink each entry in the Employer row to their own page which will be Vacancy.php

in my head I thought of doing something like this:

 echo'<tr><td><a href="Vacancy.php?ID=". $row['ID']' . ' .$row['Employer'].'</td>';

but it didn't quite work.

Thanks guys

Recommended Answers

All 5 Replies

I'm not a PHP developer, but from an HTML perpesctive it doesn't appear that you properly closed the anchor element in your example that you indicated didn't work.

You didn't close the starting tag and didn't include the content or ending tag.

Hey Jorge, that was just an example I wrote here without an IDE :P so it's slightly off.

echo '<tr><td><a href="Vacancy.php?ID=' . $row['ID'] . '">' . $row['Employer'] . '</a></td>';


echo "<tr><td><a href=\"Vacancy.php?ID={$row['ID']}\">{$row['Employer']}</a></td>"; <-- Courtesy of Pritaeas on IRC

Thanks guys :)

Be a part of the DaniWeb community

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