Jump to content

link inside an echo table?


flemingmike

Recommended Posts

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

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?

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.  :shy:

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

 

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.