ParadoxKing Posted December 15, 2007 Share Posted December 15, 2007 Hello, lets get straight into it. I have a web comic viewing script, it worked perfectly well, but it only preformed a simple task: display comics dynamically and allow viewers to scroll through comic (appending variables to the url). All this was displayed on the index page. I thought that was all fine and dandy until I decided that I wanted to have an archive page. So I integrated the script into a mySQL database. After a few tries I got it working fine (save for some problems I will mention in another thread). The pages are: Archive Comic Page And here are the codes <?php $user="root"; $password="m99r9K6"; $database="anicom"; mysql_connect("127.0.0.1",$user,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT * FROM imgcont"; $result=mysql_query($query); while ($row=mysql_fetch_array($result)) { print "<li><span class='php'><a href='comic.php?id={$row["id"]}' target='comix'>{$row["title"]}</a></span></li>"; } ?> <?php $user="root"; $password="m99r9K6"; $database="anicom"; mysql_connect("127.0.0.1",$user,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT * FROM imgcont WHERE id='$id'"; $result=mysql_query($query); while ($row = mysql_fetch_array($result)) { $maximages=2; echo sprintf("<img src='comic{$row["id"]}.png' /> \n"); echo sprintf("<a href=\"comic.php?id=%d\">\n<img border=\"0\" src=\"back.png\" alt=\"Previous Comic\" align=\"left\" />\n</a> \n",(($row['id']-1>0)?(--$row['id'])$row['id']))); echo sprintf("<a href=\"comic.php?id=%d\">\n<img border=\"0\" src=\"next.png\" align=\"right\" alt=\"Next Comic\" />\n</a> \n",(($row['id']+1<=$maximages)?(++$row['id'])$row['id']))); } ?> So, that works fine. But then I got complaints about moving the comics off the index page. So I decided that I would use <iframe></iframe> tags and put archive and comic pages on the index page through that. Here is the page: Club Index And the very very basic code: <iframe name="comix" src="archive.php" frameborder="0" class="fr" allowtransparency="true"/> Unfortunately that defeated half the functionality of the original script, I the comic id was not displayed in the url anymore as it was on a different page. Here is my question: How do I append the id var in the iframe to the index page url? Quote Link to comment Share on other sites More sharing options...
phporcaffeine Posted December 15, 2007 Share Posted December 15, 2007 the page that the iframe targets is by all rights, a seperate and unique page and therefore doesn't access the same namespace as the parent. In your iframe tag, when you target the framed page, target it with $_GET args .... thats the only way. Depending on how your site works, this might not work for you. Quote Link to comment Share on other sites More sharing options...
ParadoxKing Posted December 16, 2007 Author Share Posted December 16, 2007 Thanks, can you think of any alternative means other than using (i)frames to get what I want to do? 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.