ICKelly Posted April 4, 2007 Share Posted April 4, 2007 I have a list of names, on a index page. When you click on a name it takes you to that information. I want to create the same page, which I have done, and then place the data as per the click to open in that page at the same time? If() Then() Do I write arrays. I have been trying to figure out what is the best method. Really new to php. Been reading for a couple weeks now. The tutorial is long I really like the inlude statement. Thanks in advance for any pointers, Quote Link to comment https://forums.phpfreaks.com/topic/45578-if-get-what-list-hyperlink-to-common-page-opening/ Share on other sites More sharing options...
wildteen88 Posted April 4, 2007 Share Posted April 4, 2007 Is the list of names stored in a table, and those list of names correspond to another table that has the content? If thats the case then just do a simple sql query then check that the sql query returns the results if it did display then. $name = isset($_GET['name']) ? mysql_real_escape_string($_GET['name']) : 'noName'; $sql = "SELECT * FROM `names.name` WHERE `content.name`= '$name'"; $result = mysql_query($sql); if(mysql_num_rows($result) == 1) { // match found! Display the content for the name } else { // No matches. Display an error here. } Quote Link to comment https://forums.phpfreaks.com/topic/45578-if-get-what-list-hyperlink-to-common-page-opening/#findComment-221348 Share on other sites More sharing options...
ICKelly Posted April 4, 2007 Author Share Posted April 4, 2007 Is the list of names stored in a table, and those list of names correspond to another table that has the content? If thats the case then just do a simple sql query then check that the sql query returns the results if it did display then. $name = isset($_GET['name']) ? mysql_real_escape_string($_GET['name']) : 'noName'; $sql = "SELECT * FROM `names.name` WHERE `content.name`= '$name'"; $result = mysql_query($sql); if(mysql_num_rows($result) == 1) { // match found! Display the content for the name } else { // No matches. Display an error here. } OK let me go read back up on that. I understand what its doing but not sure if its for every line within each php file. Currently using: <?php include ("index_lista.php"); ?> b, c, d etc.... then: <html> <body> <p><a href="http://www.name.com/phpa/index_a.php"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000">-A-</font></b></a><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000"><br> <a href="index_accountants.php" target="_blank">Accountants</a><br> <a href="http://www.name.com/index_aircraftservice.php" target="_blank">Aircraft Service</a><br> <a href="http://www.name.com/index_airport.php" target="_blank">Airport</a><br> <a href="http://www.name.com/index_ambserv.php" target="_blank">Ambulance Service</a><br> <a href="http://www.name.com/index_ah.php" target="_blank">Animal Hospitals</a><br> <a href="http://www.name.com/index_animal_groomers.php" target="_blank">Animal Groomers</a><br> <a href="http://www.name.com/index_appliance_service_repair.php" target="_blank">Appliance Service/Repair</a><br> <a href="http://www.name.com/index_auto_appraisers.php" target="_blank">Auto Appraisers</a><br> <a href="http://www.name.com/index_auto_body_collision.php" target="_blank">Auto Body Shops/Collision Centers</a><br> <a href="http://www.name.com/index_auto_parts.php" target="_blank">Auto Parts/Supplies</a><br> <a href="http://www.name.com/index_auto_sales.php" target="_blank">Auto Sales</a><br> <a href="http://www.name.com/index_auto_service_repair.php" target="_blank">Auto Repairs/Service</a><br> <a href="http://www.name.com/index_auto_salvage.php" target="_blank">Auto Recyclers/Salvage</a></font> THe above opens onto a blank window. I just think it would look much better opening in the same style window as the home page. So I can see what your saying just gotta figure how it fits into the sequence. Quote Link to comment https://forums.phpfreaks.com/topic/45578-if-get-what-list-hyperlink-to-common-page-opening/#findComment-221570 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.