views:

485

answers:

2

Hi All.

I'm trying to understand this bit of code:

in display.php:

<html>
...
<body>
  <table>
     <tr>
       <td>
         User info: <iframe id="SpControlFrame1" name="SpControlFrame1" src="javascript:'';"path_src="index.php?cmd=YYY" ></iframe>
        </td>
     </tr>
   </table>
 </body>
 </html>

in another file, I have a switch statement:

main.php

switch ("cmd") {
 case ZZZ:
   include("foo.php");
   break;
 case YYY:
   include("blah.php")
   break;
}

blah.php:

<?php
 //some funtions for processing
?>
<html>
 <head>
  ...
 </head>
 <body>
   <input type="text" size="12" name="username">
   <input type="button" value="submit">
  </body>
</html>

1) So, can some explain what is happening here? The iframe is embedded in the page and doesn't cause a reload or anything like that.

2) I'm trying to duplicate this functionality on another page but the iframe is always empty (i've verified this using the IE developer Toolbar)

Thanks Chris

+2  A: 

Without seeing the code in question, I couldn't really say what's happening. Your example presumes that the code in question is server-side, and when a particular variable/condition is met, then the iframe is created or populated by blah.php.

You would have to ensure that the same code is called when creating this other iframe. Perhaps you could expand on the code in question? Source for the original, and source for the new (not the iframe, but the containing document).

Chris Kaminski
A: 

How does this work for you?

User info: <iframe id="SpControlFrame1" name="SpControlFrame1" src="index.php?cmd=YYY" ></iframe>
Hans