Tom
Tom

Reputation: 17

Send POST data to iframe and host page

I am have a problem with Sending data from a Form to my iframe page. I have a host page that is called from the Form and the Form is using the POST method this works. I am then trying to send that same POST data with in a iframe.

<iframe src="dirread.php?var=<?php echo urlencode($_POST['filename']);?>"  width="300px" height="700px" scrolling="yes">

So this works for one but I want to send two Lots

 <iframe src="dirread.php?var=<?php echo urlencode($_POST['filename'],$_POST['site'] );?>"  width="300px" height="700px" scrolling="yes">

What is the correct syntax please?

Upvotes: 0

Views: 1960

Answers (2)

csandreas1
csandreas1

Reputation: 2378

<form action="iframe.php" target="my-iframe" method="post">
			
  <label for="text">Some text:</label>
  <input type="text" name="text" id="text">
			
  <input type="submit" value="post">
			
</form>
		
<iframe name="my-iframe" src="iframe.php"></iframe>

Upvotes: 1

nv1t
nv1t

Reputation: 498

You are sending the POST-Parameters as GET-Parameters to the iframe. To send 2 Variables you have to use:

<iframe src="dirread.php?var=<?php echo urlencode($_POST['filename']); ?>&var2=<?php echo urlencode($_POST['site'] );?>"  width="300px" height="700px" scrolling="yes">

There is no way to send POST Data inside an iframe.

Upvotes: 0

Related Questions