passing data from 1 php page to another

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
pleigh
Forum Contributor
Posts: 445
Joined: Wed Jan 19, 2005 4:26 am

passing data from 1 php page to another

Post by pleigh »

in my knowledge, this could be done in javascript,since i don't know javascript,here's my question...is it possible that if i have a page opened,there is a textbox there,beside the textbox is a link that will open a new php page,a smaller one...the idea is that, i want to input some data to that smaller page and then as i click ok,the smaller page will be closed and it will pass data to the textbox of the first page.

can this be done in php alone??

thanks in advance? :)
dyonak
Forum Commoner
Posts: 56
Joined: Wed Jun 22, 2005 10:22 am
Location: Minneapolis, MN
Contact:

Post by dyonak »

It can be done easily enough. This tutorial is a great start:
Sessions Tutorial

Although reading your post again, this may not entirely work. It would require a refresh on the first page before the data was loaded into it from the second page. This is all based on my limited understanding of PHP so I could be wrong, in which case someone much brighter than myself should be along shortly to explain.
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

here's a purely js solution:

Code: Select all

<form name=&quote;MyForm&quote;>
<input type=&quote;text&quote; name=&quote;myText&quote;> <a href=&quote;javascript:window.open('child.php','child','width=400,height=400');&quote;>open win</a>
</form>

Code: Select all

<input type=&quote;text&quote; onKeyDown=&quote;opener.document.MyForm.myText.value = this.value&quote; name=&quote;bob&quote;>
User avatar
pleigh
Forum Contributor
Posts: 445
Joined: Wed Jan 19, 2005 4:26 am

Post by pleigh »

Burrito wrote:here's a purely js solution:

Code: Select all

<input type=&quote;text&quote; onKeyDown=&quote;opener.document.MyForm.myText.value = this.value&quote; name=&quote;bob&quote;>
thanks burrito...where is the submit button....and where can i point that button?
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

submit button for which? you can put the submit button wherever you want?

did you want the submit button to populate the form on the parent? If so, just use a <button> tag and use onClick instead of onKeydown.
Post Reply