Jump to content

Recommended Posts

Hey everyone!

 

I need to figure how to do this, if someone could help.

 

I want to have like 5 hidden i frames ( each i frames have  a txt box with  different name for each)  and on the main page i want a form with 1 txt box and what ever the user enters in their and hits submit it will post to the other iframes also.

 

Any idea?

Link to comment
https://forums.phpfreaks.com/topic/132459-how-would-i-do-this-in-php/
Share on other sites

I am assuming those IFrames are for external pages that you are trying to post the same information to. Don't use frames - use curl.

 

You wouldn't be able to do what you are asking with PHP anyway. PHP is server-side. If the frames ahve content already loaded there is no way for PHP to interact with those pages. If they are external pages I don't think there is even a way to do it with JavaScript if you don't have access to modify those pages.

 

 

Well im just trying to post to the other iframes. So if i got a name box and on the other iframes they got a name box with a submit i just wanna post to it.

 

But i wanna be able to do this with php and also  if iframe 1 has a input field with the name user and iframe 2 has a input field with the name user12 i want to be able to make it so i can post to both.

 

I coded this in javascript.

 

<form name="site" method="post">

<input name="name" size="50" maxlength="60" type="text">

<p>



</p><p>
<input value="Submit" onclick="execute();" type="button">



<iframe name="myframe" src="" width="0" frameborder="0" height="0"></iframe>
<iframe name="myframe2" src="" width="0" frameborder="0" height="0"></iframe>
<iframe name="myframe3" src="" width="0" frameborder="0" height="0"></iframe>
<iframe name="myframe4" src="" width="0" frameborder="0" height="0"></iframe>
<iframe name="myframe5" src="" width="0" frameborder="0" height="0"></iframe>
<iframe name="myframe6" src="" width="0" frameborder="0" height="0"></iframe>
<iframe name="myframe7" src="" width="0" frameborder="0" height="0"></iframe>
<iframe name="myframe8" src="" width="0" frameborder="0" height="0"></iframe>
<iframe name="myframe9" src="" width="0" frameborder="0" height="0"></iframe>
<iframe name="myframe10" src="" width="0" frameborder="0" height="0"></iframe>



<script>

function sites()
{
  document.site.action="http://url.com/submit.php";
  document.site.target="myframe";
  document.site.submit();

  document.site.action="http://url.com/submit.php";
  document.site.target="myframe2";
  document.site.submit();

  document.site.action="http://url.com/submit.php";
  document.site.target="myframe3";
  document.site.submit();
  document.site.action="http://url.com/submit.php";
  document.site.target="myframe4";
  document.site.submit();

  document.site.action="http://url.com/submit.php";
  document.site.target="myframe5";
  document.site.submit();

  document.site.action="http://url.com/submit.php";
  document.site.target="myframe6";
  document.site.submit();

  document.site.action="http://url.com/submit.php";
  document.site.target="myframe7";
  document.site.submit();

  document.site.action="http://url.com/submit.php";
  document.site.target="myframe8";
  document.site.submit();


  document.site.action="http://url.com/submit.php";
  document.site.target="myframe9";
  document.site.submit();


  document.site.action="http://url.com/submit.php";
  document.site.target="myframe10";
  document.site.submit();


}


function execute()
{
     sites();
// to redirect when the form is submitted after so many milliseconds
    //setTimeout("window.location='http://google.com'", 17000)
}
</script>

</form>

I may be jumping the gun, but I do not think php can do this...

 

Javascript is done on the POST side, PHP is all PRE. Without a page refresh it cannot be done. Javascript is your best bet.

 

I could be wrong, but given your definition that is the only way I see it without refreshing all the iframe pages. Stick to JS it will make it easier.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.