Jump to content

Recommended Posts

i have a Table and inside the Table in one Row, is text and the Other one is an Iframe.

 

main.php

<TABLE height="100%" width="100%" CELLSPACING="0" CELLPADDING="0" border=1>
<tr>
<td>
Some text is here
Some Links Which Link to the iframe.
</td>
<td>
<iframe name="mainbody" src="quaters.php" width="770" height="561" frameborder=0></iframe>
</td>
</tr>
</table>

 

And before all that i have a PHP include putting in a header File Containing the Time.

 

header.php

<center>
<table width="200">
<tr>
<td>
<strong>
<?php
include("include/db.php");
echo "<marquee>";
$date=date("H:i");
$Sdate=date("H");
$Sdate1=date("i");
$Sdate1=$Sdate1-10;
$sdate=$Sdate.$Sdate1;
echo $date;
echo "</marquee>";
$last_active=mysql_query("UPDATE players SET last_active='$date' WHERE id='$PID'");

?>

</td>
</tr>
</table>
</center>

 

Now what i want it to do, is whenever a link is Pressed Either in the Main Body or in the Iframe i want the header.php to Reload and update the Time.

Link to comment
https://forums.phpfreaks.com/topic/83935-update-problem/
Share on other sites

updatetime.js

-------------------------

var xmlHttp

function updateTime(str)
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="incl/header.php";
url=url+"?click="+str;
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function stateChanged() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("updateTime").innerHTML=xmlHttp.responseText;

}
}

 

 

 

 

 

header.php

----------------------

<?php
if(isset($_GET['click']) {

if($_GET['click'] == "yes") {
echo "<marquee>";
$date=date("H:i");
$Sdate=date("H");
$Sdate1=date("i");
$Sdate1=$Sdate1-10;
$sdate=$Sdate.$Sdate1;
echo $date;
echo "</marquee>";
}

}
?>

 

 

 

 

 

main.php

------------------------------------

<html>

<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">

<title>Untitled</title>
<script type="text/javascript" src="updatetime.js"></script>
</head>

<body>
<div id="updateTime"></div>


<TABLE height="100%" width="100%" CELLSPACING="0" CELLPADDING="0" border=1>
<tr>
<td>
<a href="link.php" onClick="updateTime('yes')" target="mainbody">Link IFRAME</a>
<a href="link.php" onClick="updateTime('yes')">Link No Frame</a>
</td>
<td>
<iframe name="mainbody" src="quaters.php" width="770" height="561" frameborder=0></iframe>
</td>
</tr>
</table>

</body>
</html>

 

 

i am going to test this now. but this should be right..

 

Link to comment
https://forums.phpfreaks.com/topic/83935-update-problem/#findComment-427154
Share on other sites

<a href="link.php" onClick="updateTime('yes')" target="mainbody">Link IFRAME</a>

<a href="link.php" onClick="updateTime('yes')">Link No Frame</a>

 

See with every single Link i will need that onclick (sorry not Javscript :( )

 

So is there a way to do it without Having to have the onclick on every single Link?

Link to comment
https://forums.phpfreaks.com/topic/83935-update-problem/#findComment-427785
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.