Deanznet Posted November 12, 2008 Share Posted November 12, 2008 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? Quote Link to comment https://forums.phpfreaks.com/topic/132459-how-would-i-do-this-in-php/ Share on other sites More sharing options...
.josh Posted November 12, 2008 Share Posted November 12, 2008 Well it looks like you already have your idea. Now break it down and start coding. Google how to make an iframe. Google how to make a form. Google how to use submitted form values. Google how to print variables to the screen. Quote Link to comment https://forums.phpfreaks.com/topic/132459-how-would-i-do-this-in-php/#findComment-688684 Share on other sites More sharing options...
Psycho Posted November 12, 2008 Share Posted November 12, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/132459-how-would-i-do-this-in-php/#findComment-688686 Share on other sites More sharing options...
Deanznet Posted November 12, 2008 Author Share Posted November 12, 2008 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> Quote Link to comment https://forums.phpfreaks.com/topic/132459-how-would-i-do-this-in-php/#findComment-688763 Share on other sites More sharing options...
premiso Posted November 12, 2008 Share Posted November 12, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/132459-how-would-i-do-this-in-php/#findComment-688776 Share on other sites More sharing options...
Deanznet Posted November 12, 2008 Author Share Posted November 12, 2008 Okay, but is their anyway i can use Js to define what forms i need it to post to in the iframes? Quote Link to comment https://forums.phpfreaks.com/topic/132459-how-would-i-do-this-in-php/#findComment-688785 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.