I'm trying to pass a variable through a URL to an iframe, which in turn should pass the variable to the iframe source script. Getting the variable from the URL to the iframe is not a problem and this seems to be working fine. However, the variable doesn't seem to be being passed to the iframe source script. This is the link, which passes the variable along the URL to the iframe. This is working fine: echo "<th align = right colspan = 3><font face = 'arial'><a href = 'http://www.thedatacentre.org/rms/v2/homepage/forward_message.php?msg_id=$msg_id' style='text-decoration:none'>Forward</a></font>\n"; PHP: This section of the iframe script is the link to the iframe source script. <iframe src="http://www.thedatacentre.org/rms/v2/homepage/forward_message_frame.php?msg_id=<?php $msg = $_GET['msg_id'];?>" name="forwardiframe" width="100%" height="450" border="0" frameborder="0" scrolling="no" ></iframe> PHP: As you can I am trying to pass the variable to the source using the $_GET method. When the page loads it appears as though the variable is being sent as you can see the progress of the transaction at the bottom of the screen, however, I've tried echoeing the variable + the screen is blank. Any ideas?
Do you see that the iframe has the correct url if you look at the source code? Should look like: <iframe src="http://www.thedatacentre.org/rms/v2/homepage/forward_message_frame.php?msg_id=1" name="forwardiframe" width="100%" height="450" border="0" frameborder="0" scrolling="no" ></iframe>
This is what I get when I view the source code, as you can see msg_id is blank: <iframe src="http://www.thedatacentre.org/rms/v2/homepage/forward_message_frame.php?msg_id=" name="forwardiframe" width="100%" height="450" border="0" frameborder="0" scrolling="no" ></iframe> HTML:
your frame drawer file. <?php $pass = $_GET['msg_id']; ?> <iframe src="yourscript.php?msg_id=<?php echo($pass)?>" name="forwardiframe"> </iframe> PHP: ---------- And in your yourscript.php <?php echo($_GET['msg_id']); ?> PHP: If the scripts above don't work (it should work), please copy the iframe target file source here
That works great, thank you very much. I was trying something similiar, but couldn't seem to get it working. Consider your reputation boosted!