flemingmike Posted September 21, 2010 Share Posted September 21, 2010 hello, im trying to add a hyperlink that launches in a new window to the following (in the last column) any ideas? echo "<tr>"; echo "<td align='center'>" . $row["ID"] . "</td>"; echo "<td align='center'>" . $row["Name"] . "</td>"; echo "<td align='center'>" . $row["jobNO"] . "</td>"; echo "<td align='center'>" . $epn . "</td>"; echo "<td align='center'>" . $cname . "</td>"; echo "<td align='center'>" . $cadd . "</td>"; //want to add a hyperlink here echo "</tr>"; } echo "</table>"; } Link to comment https://forums.phpfreaks.com/topic/213965-link-inside-an-echo-table/ Share on other sites More sharing options...
Pikachu2000 Posted September 21, 2010 Share Posted September 21, 2010 Since that appears to be part of a while{} loop, it's important to ask if you want the same link repeated, or if each record has its own unique link. If each is uniquer, where are they coming from, the same database query? Link to comment https://forums.phpfreaks.com/topic/213965-link-inside-an-echo-table/#findComment-1113545 Share on other sites More sharing options...
flemingmike Posted September 21, 2010 Author Share Posted September 21, 2010 the link will be repeated. i would like the link to look like <a href="http://mapof.it/$cadd">$cadd</a> Link to comment https://forums.phpfreaks.com/topic/213965-link-inside-an-echo-table/#findComment-1113546 Share on other sites More sharing options...
Namtip Posted September 21, 2010 Share Posted September 21, 2010 I'm sorry If this is incorrect, I'm only trying to help. I've done something similar to this and I coded it like this: echo "<table width='80%'>"; while ($row = mysql_fetch_assoc($album)) { echo " <tr> <td> <img src='".$row['cover']."' width='100' height='100' </td> <td> <b><a href='viewalbum.php?album=".$row['$id']."'>".$row['name']."</a></b><br> ".$row['decription']."<br> ".$row['count']." items<br> <a href='deletealbum.php?album=".$row['id']."'>Delete</a> </td> </tr> "; } echo "</table>"; so for your code it might be like this? <?php echo "<table width='80%'>"; while ($row = mysql_fetch_assoc($database)) { echo " <tr> <td align='center'>" . $row["ID"] . "</td> <td align='center'>" . $row["Name"] . "</td> <td align='center'>" . $row["jobNO"] . "</td> <td align='center'>" . $epn . "</td> <td align='center'>" . $cname . "</td> <a href='http://mapof.it/".$cadd."'>$cadd</a> </td> </tr> "; } echo "</table>"; ?> Ignore me if I'm talking rubbish. Link to comment https://forums.phpfreaks.com/topic/213965-link-inside-an-echo-table/#findComment-1113568 Share on other sites More sharing options...
chintansshah Posted September 21, 2010 Share Posted September 21, 2010 You can concat your echo string, like echo "<td><a href='index.php?id=".$cadd."' target='_blank'>VIEW ANYTHING</a>"; Link to comment https://forums.phpfreaks.com/topic/213965-link-inside-an-echo-table/#findComment-1113609 Share on other sites More sharing options...
rwwd Posted September 21, 2010 Share Posted September 21, 2010 this is the toothpicked version, using single quotes can negate this, but I don't think that it passes validation. echo "<td align=\"center\"><a href=\"http://mapof.it/".$cadd."\">".$cadd."</a></td>\n\r"; Have fun, Rw Link to comment https://forums.phpfreaks.com/topic/213965-link-inside-an-echo-table/#findComment-1113612 Share on other sites More sharing options...
googlit Posted September 21, 2010 Share Posted September 21, 2010 Try This <?php echo "<tr>"; echo "<td align='center'>" . $row["ID"] . "</td>"; echo "<td align='center'>" . $row["Name"] . "</td>"; echo "<td align='center'>" . $row["jobNO"] . "</td>"; echo "<td align='center'>" . $epn . "</td>"; echo "<td align='center'>" . $cname . "</td>"; echo "<td align='center'><a href=\"link.php?id=['$link']\">' . $cadd . '</a></td>"; //want to add a hyperlink here echo "</tr>"; echo "</table>"; ?> Link to comment https://forums.phpfreaks.com/topic/213965-link-inside-an-echo-table/#findComment-1113697 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.