Jump to content

php Posting to Iframe?


Deanznet

Recommended Posts

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

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

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.