Include Pages?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jackal
Forum Newbie
Posts: 10
Joined: Sat Apr 19, 2003 3:21 pm

Include Pages?

Post by jackal »

Below are 2 pages. We open the first one and it brings up topics. When You click on one of the topics it brings up the questions pretaining to the topic. Only problem is that it brings up the questions on the second page. What change can we make that when clicked on the questions they come up on the same page underneath the topics?


Topic Page

Code: Select all

<?php 
$dbi= mysql_connect('localhost','user','pass');
mysql_select_db('dbname');
$sql_get_faq_categories1_txt = "select cid,cname from faq_categories1 where cid IN (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24)";
$sql_get_faq_categories1 = mysql_query($sql_get_faq_categories1_txt);
if (!$sql_get_faq_categories1)
die ("Error displaying information. Please report this information to the administrator -- ".$sql_get_faq_categories1_txt . " - " . mysql_error());
while(list($cid,$cname)=mysql_fetch_row($sql_get_faq_categories1))
{
echo "<a href="""questions.php?cid=$cid">$cname</a><br>";
} 
?>
Where The Topics Pull Their Questions From

Code: Select all

<?php
include("./toppage.php" );
?>
<?php 
$dbi= mysql_connect('localhost','user','pass');
mysql_select_db('dbname');
$sql_get_faq_questions1_txt = "select fid,cid,question,answer,timestamp from faq_questions1 where cid=$cid";
;
$sql_get_faq_questions1 = mysql_query($sql_get_faq_questions1_txt);
if (!$sql_get_faq_questions1)
die ("Error displaying information. Please report this information to the administrator -- ".$sql_get_faq_questions1_txt . " - " . mysql_error());
echo "<table cellpadding=0 cellspacing=0 border=0 align=center width=100%>"; 
while(list($fid,$cid,$question,$answer,$timestamp)=mysql_fetch_row($sql_get_faq_questions1))
{
echo "<link href="""/base.css" rel="stylesheet" type="text/css">

<tr>
<td valign=top>
<table>
<tr>
<td>
Q: $question
</td>
</tr>
</table>
<table cellpadding=0 cellspacing=0 border=0 align=center width=100%>
<tr>
<td valign=top>
<table>
<tr>
<td>
A:$answer
</td>
</tr>
</table>
</td>
</tr>"; 
} 
echo "</table>";
?>
<?php
include("./bottompage.php" );
?>
?>
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

you might use frames to do so
Post Reply