PHP hyperlinks in a iFrame passing to a iFrame in index.php
Posted: Thu Jul 26, 2012 3:37 pm
I am working on making a php site and am fairly new to php. The home page index.php has two iframes one on the left (name=pages) and one on the right (name=pdf). Above the iframe on the left are CSS buttons to open php files into the left iframe. One of the php files (Spec_list.php) opens with links generated from mysql into the left iframe. The links work when loading just the Spec_list.php but for some strange reason do not load when loading in the iframe. (both php files located in the same folder). I would then also like to get the links to open there pdf files into the iframe on the right hand side. I would like to be able to open diffident php files similar to spec_list.php in the left side who's links then open into the right iframe.
Index.php
Index.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>Main Page</title> <link href="css/Untitled_1.css" rel="stylesheet" type="text/css" /> <link rel="stylesheet" href="css/Untitled_1.css" type="text/css" media="screen, projection"/> <!--[if lte IE 7]> <link rel="stylesheet" type="text/css" href="css/ie.css" media="screen" /> <![endif]--> <script type="text/javascript" src="js/jquery-1.3.1.min.js"></script> <script type="text/javascript" language="javascript" src="js/jquery.dropdownPlain.js"></script> </head> <body> <div id="body"> <div id="left"> <ul class="dropdown"> <li><a href="spec/Spec List.php" target="pages">Specification</a></li> <li><a href="../aboutus.htm" target="pages">About Us</a></li> <li><a href="../contact.htm" target="pages">Contact Us</a></li> </ul> <!-- Test Div <div id="pages" style='width: 400px; height:600px; background-color:gray; clear: both; overflow: auto; padding: auto 15px;'></div> --> <iframe name="pages" style="width: 399px; height:775px; clear:both; overflow:auto; padding: auto 15px;" border="0" frameborder="0"></iframe> </div> <div id="right"> <iframe name="pdf" style="width: 617px; height:793px; clear:both; overflow:auto; " border="0" frameborder="0"></iframe> </div> <div id="bottom"> </div> </div> </body> </html>spec_list.php
<?php // List Projects spec numbers with links to there spec numbers include('conect.php'); //Query to pull data from Chris Anthony Business (Should be changed to userID variable to work with login and password system. May need new query or may need new relationships. $query = mysql_query("SELECT `contacts`.`first_name`, `contacts`.`last_name`, `contacts`.`company`, `spec`.`spec`, `spec`.`discription` FROM `canthony`.`project_spec` AS `project_spec`, `canthony`.`project` AS `project`, `canthony`.`spec` AS `spec`, `canthony`.`contacts` AS `contacts` WHERE `project_spec`.`Project_ID` = `project`.`Project_ID` AND `project_spec`.`spec` = `spec`.`spec` AND `contacts`.`first_name` = 'Chris' AND `contacts`.`last_name` = 'Anthony'"); //query the database //fetch the results and convert results into an array WHILE ($rows = mysql_fetch_array($query)): //Fetch data from $query as long as there is data to fetch $rows = preg_replace('/[\x00-\x1F\x80-\xFF]/', '', $rows); //Makes $rows variables print friendly characters // assign fields from the query to Variables $first_name = $rows['first_name']; $last_name = $rows['last_name']; $company = $rows['company']; $spec = $rows['spec']; $discription = $rows['discription']; $spec = str_replace (" ", "", $spec); //removes spaces from $spec variable echo '<a href="spec/',$spec,'.pdf">',$spec,' ',$discription,'</a><br/>'; // "$spec $discription": $pdf="$spec"; break; endwhile; ?>I have also tried by converting my variables to session variables and the spec_list.php links still will not work when loaded in the left iframe.