Deanznet Posted July 21, 2008 Share Posted July 21, 2008 Hey Everyone! I just have a quick question on how to do this if its possible.. lets say you have <form action="welcome.php" method="post"> Enter your name: <input type="text" name="name" /> Enter your age: <input type="text" name="age" /> <input type="submit" /> </form> on the page, and you also have welcome.php as a iframe witch has Welcome <?php echo $_POST["name"]; ?>.<br /> You are <?php echo $_POST["age"]; ?> years old! That code in it. Is their anyway you can hit submit and instead of refreshing the whole page it just updates the iframe? Example codes taking from w3schools. Any examples on how will be great! Link to comment https://forums.phpfreaks.com/topic/115847-php-posting-to-iframe/ Share on other sites More sharing options...
wilkesy1 Posted July 21, 2008 Share Posted July 21, 2008 Hi, The way i did this was using a bit of Javascript and using a HTML button rather than a form submit <input type="button" onClick="parent.frame1.location.href='build_plan.php?table=<?php echo $build; ?>'" value="Get Requirements" > enter your variables into the URL and use $_GET in your iframe file. Hope this helps Paul Link to comment https://forums.phpfreaks.com/topic/115847-php-posting-to-iframe/#findComment-595564 Share on other sites More sharing options...
Deanznet Posted July 21, 2008 Author Share Posted July 21, 2008 Hey! alright that helps! But im having 1 problem! okay i get the $_Get Part and that works. I can go to ggg.php?color=red and it works! But now i have problems with the iframe. <input type="button" onClick="parent.frame1.location.href='build_plan.php?table=<?php echo $build; ?>'" value="Get Requirements" > But it seems like your pre defining $build. My script uses hiddent input box <input type="hidden" id="in_backgroundColor" name="in_backgroundColor" value="rgb(255,255,255)" /> Like that.. so how would that work? Link to comment https://forums.phpfreaks.com/topic/115847-php-posting-to-iframe/#findComment-595660 Share on other sites More sharing options...
corbin Posted July 21, 2008 Share Posted July 21, 2008 If I remember right, you can do this with iframes: <iframe id="iframe1" href="http://somewhere.com/"> </iframe> <form action="somepage.php" target="iframe1"> <!-- form content --> </form> I might just be imagining that you can do that though x.x. Link to comment https://forums.phpfreaks.com/topic/115847-php-posting-to-iframe/#findComment-595666 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.