Forum Moderators: coopster

Message Too Old, No Replies

problems while using php code in iframe

         

kniceguy2know

5:45 pm on Mar 25, 2004 (gmt 0)

10+ Year Member



Hi! I am an absolute newbie who's trying to put together a small CMS using PHP and mysql. Anyway, the basic page is designed to show some rows of data which the user may select for editing, and a small form to enter new data. The script was working fine till I decided to display the data in an iframe, so that a user wouldn't have to scroll down a long way to access the data entry form. As the source for the iframe, i used a new page which simply had the code that i used to display data earlier. The problem now is that the display works beautifully but clicking on the rows does nothing.

Code:
if (!$news_id)
{ // print the list if a record has not been selected
?>
<IFRAME width="100%" src="news_de_data.php" height="50%" frameborder="text/plain" marginheight="0" marginwidth="0">
</IFRAME>
<?PHP
}//main file area

-------------------------------
//from news_de_data.php
<?PHP
$db = mysql_connect("x.x.x.x", "x");
mysql_select_db("x",$db);
$result = mysql_query("SELECT * FROM news_de");
printf( "<TABLE border=\"1\"> <TR> <TH colspan=\"3\" align=\"center\">Data</TH></TR>");
echo "<tr><th align=\"left\" width=\"30%\">News_ID</th><th align=\"left\" width=\"30%\">Date of posting</th><th align=\"left\" width=\"40%\">Details</th> <tr>";
while ($myrow = mysql_fetch_array($result))
{
printf("<tr align=\"left\"><td><a href=\"%s? news_id=%s\">%s</a> </td><td>%s </td><td nowrap>%s ", $_SERVER['PHP_SELF'], $myrow["news_ID"], $myrow["news_ID"],$myrow["date"], substr($myrow["details"],0,49));
printf("<a href=\"%s?news_id=%s&delete=yes\">(DELETE)</a></td>", $_SERVER['PHP_SELF'], $myrow["news_ID"]);
}
echo "</table>";
?>

If more code is needed I'll be happy to post it. Thanks!

ScottM

12:03 am on Mar 27, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



First of all, Welcome to WebmasterWorld!

I wish I could help you out with this, but it's beyond the scope of my talents.

I'm thinking one of our resident experts will be along shortly with a simple solution for you!

jatar_k

6:41 pm on Mar 27, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld kniceguy2know,

hm, if it worked until you pur it in the iframe I wonder if it is the $_SERVER['PHP_SELF'] messing up the hrefs. Maybe try putting the path to the file inthere specifically.

I would also compare what the output looks like by viewing source when it is in the iframe and when it isn't the PHP_SELF looks like the only part that would be different.

kniceguy2know

3:11 pm on Mar 29, 2004 (gmt 0)

10+ Year Member



thanx for the welcome ppl! I didn't get anywhere with the iframe concept so I decided to use a floating link that would allow a user to access the data form quickly. Thanks all the same! Looking forward to participating in the forums.