将POST数据发送到iframe和主页

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?

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.

<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>

</div>