1.11M Members

show url in iFrame

 
0
 

i'm using an iframe for our project. when i run the project, the url will be http://localhost/iset/tech/mainTech.php. but mainTech is an iframe, so it doesn't show the url of the pages that changes inside the iframe. how do i show the url of the pages inside? cause i need to get the value of the links clicked in the other pages, but i cant because the url doesnt change. it is always http://localhost/iset/tech/mainTech.php.

thanks in advance!

<?php
session_start();
    if(!session_is_registered(myusername)){
        header("Location:main_login.php");
     }
?>

<html>
<head>
<title>Technician Account</title>

<style type="text/css">
<!--
a:link {
    text-decoration: none;
    color: #FFF;
}

a:visited {
    text-decoration: none;
    color: #FFF;
}

a:hover {
    text-decoration: none;
    color: #FC3;
}

a:active {
    text-decoration: none;
}

.navigation {
    font-family: "Myriad Pro Light", "Myriad Pro";
    font-weight: bolder;
    color:#FFF;
    font-size:large;
    text-align:center;
}

.styleA { 
    font-family: futura md;    
    font-weight: bold; 
    font-size: medium; 
    color: #FFF;
}
.user_details {
    font-family: "Myriad Pro Light", "Myriad Pro";
    color:#333;
    font-style: italic;
    font-size:14px;
}
-->
</style>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<body background="images/background1.jpg">
<table width="95%" border="0" align="center" bgcolor="#FF9900">
  <tr>
    <td height="93"><table width="100%" border="0">
        <tr>
          <td width="69%" height="44"><img src="../_images/logobottom.png" width="351    " height="41"></td>
          <td width="8%">&nbsp;</td>
          <td width="23%" rowspan="2"><img src="../_images/top.png" width="250px" height="85px" align="right"/></td>
        </tr>
        <tr>
          <td height="37" valign="bottom"><table width="97%" border="0" align="left" >
            <tr class="navigation">
              <td width="1%" align="center">|</td>
              <td width="23%" align="center"><a href="techHome.php" target="mainDiv">Home</a></td>
              <td width="1%" align="center">|</td>
              <td width="23%" align="center"><a href="techReport_Tab.php" target="mainDiv">Trouble Ticket</a></td>
              <td width="1%" align="center">|</td>
              <td width="23%" align="center"><a href="techPreventive_Tab.php" target="mainDiv">Preventive Maintenance</a></td>
              <td width="1%" align="center">|</td>
              <td width="23%" align="center"><a href="techHelp.php" target="mainDiv">Help</a></td>
              <td width="1%" align="center">|</td>
              <td width="23%" align="center"><a href="..\Logout.php">Logout</a></td>
              <td width="1%" align="center">|</td>
            </tr>
          </table></td>
          <td>&nbsp;</td>
        </tr>
      </table></td>
  </tr>
  <tr>
    <td><iframe name="mainDiv" width="100%" frameborder="0" style="background-image:url(../_images/background2.jpg)" height="520px" src="techHome.php"></iframe></td>
  </tr>
</table>
<table width="95%" border="0" align="center">
  <tr>
    <td width="75%">&nbsp;</td>
    <td width="25%"><table width="100%" border="0" style="text-align: center; font-weight: normal; border-collapse:collapse; border:1px solid #333" cellpadding="2" cellspacing="2" >
      <tr>
        <td width="10%" align="center"><img src="../_images/user.png" width="21" height="22"></td>
        <td width="40%" align="left"><span class="user_details">
        <?php
            include "..\configdb.php";
            include "..\opendb.php";
            
            $myusername = $_SESSION['username'];
            $mypassword = $_SESSION['password'];
            
            $sql="SELECT _firstName, _lastName FROM user_accounts WHERE _userId='$myusername' and _password='$mypassword'";
            $result=mysql_query($sql);
            
            if(!$result) {
                echo 'Could not run query: ' . mysql_error();
                exit;
            }

            while($row=mysql_fetch_array($result))
            {
                echo $row['_firstName']." ".$row['_lastName'];
            }    // end while loop

          include "..\closedb.php";
      ?>        
      </span></td>
        <td width="10%" align="center"><img src="../_images/date.png" width="23" height="23"></td>
        <td width="40%" align="left"><span class="user_details">
        <?php 
                $time_offset ="240"; // Change this to your time zone
                $time_a = ($time_offset * 120);
                $time = date("F d, Y g:iA",time() + $time_a);
                echo $time;
        ?>
        </span></td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>
 
0
 

You should probably ask in the Javascript forums as this can't be done in PHP. And honestly, if you really want the arguments passed to PHP to be shown in the webbrowser's addressbar than you're better of not using iframes.

[EDIT]
The only thing that I can think of to solve your problem at least is to use the global variable $SERVER. It's an array that contains information about the scriptname, the arguments passed and so on. Have a look here: http://www.php.net/manual/en/reserved.variables.server.php

You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article