crmamx Posted February 8, 2011 Share Posted February 8, 2011 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>"; ?> Quote Link to comment Share on other sites More sharing options...
johnny86 Posted February 8, 2011 Share Posted February 8, 2011 echo $row['ama'] . '.html'; // Append .html to this number Quote Link to comment Share on other sites More sharing options...
crmamx Posted February 8, 2011 Author Share Posted February 8, 2011 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.