Momment Member
Posts : 19 Join date : 2011-03-09
| Subject: $_GET Help! Sat Mar 26, 2011 5:32 pm | |
| I've got a New Posts thing on the front of my page: - Code:
-
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo "<tr valign='top'><td><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><font color=\"#FFCC00\"><b><a href=\"forumposts.php?http://www.website.com/phpBB3/viewtopic.php?f=$row[forum_id]&t=$row[topic_id]&p=$row[post_id]#p$row[post_id]\" TARGET=\"_parent\">" . $row["topic_title"] .
And I need that to open in an iframe in another page. I'm not great with php but I want to do something like: - Code:
-
<iframe name="framename" id="framename" src="<?php echo($_GET["postdata"]); ?>" width="591" height="750" scrollbar="no" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0" style="overflow: hidden;">
How can I do this, and am I even on the right track? *Frustrated* |
|
OhhOhh Member
Posts : 10 Join date : 2011-03-09
| Subject: Re: $_GET Help! Sat Mar 26, 2011 5:33 pm | |
| You're not showing us all of the script ... so I'm sort of stabbing at this ...
You create a separate PHP script (perhaps you call it "newPost.php"). That script has the MySQL query, and the scripting that displays the new posts. It's a copy of the scripting you have on your front page that displays the new posts.
On your front page, you eliminate that new post scripting and put this in it's place. <?php include("newPost.php")?>
Now, when you load your front page, it will look the same, but in actuality, the new posts are generated by the "newPost.php" script.
On any OTHER pages, you do your <iframe> thing, and the src of the <iframe> will be "newPost.php" .... OR ... you can use <?php include("newPost.php")?>
|
|
RokkaMan Member
Posts : 16 Join date : 2011-03-09
| Subject: Re: $_GET Help! Sat Mar 26, 2011 5:34 pm | |
| I think I see what you're saying, but let me elaborate on my problem a little. My front page actually has an iframe on it that only contains the newpost.php. I only put the chunk of script I was having trouble with, but let me go ahead and post the whole thing: - Code:
-
<!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 http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Z.A.C.U.S.</title> <style type="text/css"> <!-- body { background-color: #EDF89E; background-image: url(newinforumback.png); background-repeat: no-repeat; background-attachment:fixed } a:link { color: #060; } a:visited { color: #060; } a:hover { color: #0F0; } a:active { color: #0F0; } --> </style> <body topmargin="0" leftmargin="0"><?php // How Many Topics you want to display? $topicnumber = 4; // Change this to your phpBB path $urlPath = "/phpBB3"; // Database Configuration (Where your phpBB config.php file is located) include 'phpBB3/config.php'; $table_topics = $table_prefix. "topics"; $table_forums = $table_prefix. "forums"; $table_posts = $table_prefix. "posts"; $table_users = $table_prefix. "users"; $link = mysql_connect("$dbhost", "$dbuser", "$dbpasswd") or die("Could not connect"); mysql_select_db("$dbname") or die("Could not select database"); $query = "SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username FROM $table_topics t, $table_forums f, $table_posts p, $table_users u WHERE t.topic_id = p.topic_id AND f.forum_id = t.forum_id AND t.forum_id != 4 AND t.topic_status <> 2 AND p.post_id = t.topic_last_post_id AND p.poster_id = u.user_id ORDER BY p.post_id DESC LIMIT $topicnumber"; $result = mysql_query($query) or die("Query failed"); print "<table cellpadding='3' cellSpacing='0' width='232'>"; while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo "<tr valign='top'><td><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><font color=\"#FFCC00\"><b><a href=\"forumposts.php?http://www.website.com/phpBB3/viewtopic.php?f=$row[forum_id]&t=$row[topic_id]&p=$row[post_id]#p$row[post_id]\" TARGET=\"_parent\">" . $row["topic_title"] . "</a></td></font></b><td><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><font color=\"#212121\"> by: <a href=\"forumposts.php?http://www.website.com/phpBB3/memberlist.php?mode=viewprofile&u=$row[user_id]\" TARGET=\"_parent\">" . $row["username"] . "</td><td><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><font color=\"#212121\">" . date('F j, Y, g:i a', $row["post_time"]) . "</td></tr></font>"; } print "</table>"; mysql_free_result($result); mysql_close($link); ?>
</body> </html>
This displays the title of the thread, poster, etc, and when you click it, normally it would open that thread. I'm trying to get it to open that thread, in an iframe, on another page. |
|
OhhOhh Member
Posts : 10 Join date : 2011-03-09
| Subject: Re: $_GET Help! Sat Mar 26, 2011 5:35 pm | |
| |
|
LegitCoders Member
Posts : 2 Join date : 2012-01-21
| Subject: Re: $_GET Help! Sat Jan 21, 2012 5:01 am | |
| Just use the html Post forum method and make it 10x easier! - Code:
-
<html> <form method="post" action="postdata.php"> <input name="whatever" type="text" id="whatever"> <input type="Submit" name="Submit" value="Send Whatever"> </form> </html>
And then on "postdata.php" - Code:
-
<iframe name="framename" id="framename" src="<?php echo($_POST['whatever']); ?>" width="591" height="750" scrollbar="no" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0" style="overflow: hidden;">
Goodluck. ---LegitCoders.com -Cheers |
|