Page 1 of 1

passing data from 1 php page to another

Posted: Wed Jul 20, 2005 6:33 am
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? :)

Posted: Wed Jul 20, 2005 7:37 am
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.

Posted: Wed Jul 20, 2005 5:07 pm
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;>

Posted: Thu Jul 21, 2005 12:32 am
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?

Posted: Thu Jul 21, 2005 9:52 am
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.