Jump to content

Can I create an executable link from a value in an output table?


crmamx
 Share

Recommended Posts

In this output table, I would like to be able to click on any number in the ama row, add .html to that value and then execute the link.

 

Example: If the ama number in row 3 is 890543, add .html to the number = 890543.html, then click on it to link to that web page.

 

<?php // Connect to database =========================================

include("connect_db.php");
$table1='passwords';
$table2='airplanes';

// send query ===================================================

$result = mysql_query("SELECT * FROM $table2") or die(mysql_error());  

if (!$result) {
    die("Query to show fields from table failed");
}

echo "<table border='10' cellpadding='3' cellspacing='2'>";
echo "<p>View All Airplanes</p>";

echo "<tr> <th>ID</th> <th>AMA #</th> <th>Model Name</th> <th>Model MFG</th><th>Wingspan</th><th>Engine</th><th>Decibels</th></tr>";

// keeps getting the next row until there are no more to get ================

while($row = mysql_fetch_array( $result )) {

// Print out the contents of each row into a table ==========================


echo "<tr><td>";
echo $row['id'];
echo "</td><td>"; 
echo $row['ama']; // Append .html to this number
echo "</td><td>"; 
echo $row['model_name'];
echo "</td><td>"; 
echo $row['model_mfg'];
echo "</td><td>"; 
echo $row['wingspan'];
echo "</td><td>"; 
echo $row['engine'];
echo "</td><td>"; 
echo $row['decibels'];
echo "</td></tr>"; 
} 

echo "</table>";

?>

 

Link to comment
Share on other sites

That would work if I knew which number in the column (there are 45) the user wanted to link to. There are html pages for each of the 45 numbers.

 

What I would like to be able to do is place the mouse pointer over a number in the table, click on the number, have it create the link, and then execute the link, not just display it.

 

If this is not possible, how do I detect what number he wants to select with the mouse pointer and thereby echo the URL number.html.

 

I could just output the link in the table but I don't want to do that. It would confuse the user.

Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • 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.