Page 1 of 1

passing elements between pages...how??

Posted: Sat Jan 09, 2010 10:18 am
by firdous_kind86
Hi all,
i have 2 pages (suppose page1 and page2), i have a form on page1 and a data field in it, from this page1 i have to open page2 and select some data from there and the textfield on page1 gets that populated with that value,

i can do this by submiting from page2 and then another page1 will open and will get that value but i dont want to reopen page1....any ideas??

Re: passing elements between pages...how??

Posted: Tue Jan 12, 2010 8:52 am
by abushahin
Hey a simple way to do that would be to use php and then change the method of your form to GET or POST so that when your form gets submitted it passes the data to the php page and then you can do what you like with the data i.e pass it to another page, insert into db etc.

Re: passing elements between pages...how??

Posted: Wed Jan 13, 2010 12:50 am
by firdous_kind86
ok, but when i select data in second form and data is inserted in database, and i close the second form, how would the first form display that data without being reloaded, is there a way or is it possible?

the example is same like when u select multiple email addresses on hotmail , a seperate form is opened where u select the emails addresses from the contacts, and when u close, the selected email addresses appear at your parent page.

Re: passing elements between pages...how??

Posted: Wed Jan 13, 2010 2:36 pm
by abushahin
Ok to get data back to page one all over again you need to query that db for whatever your looking for, and that would mean refresh but you can set it to refresh automatically if thats what you are worried about otherwise ajax maybe your solution

Re: passing elements between pages...how??

Posted: Thu Jan 14, 2010 2:39 am
by firdous_kind86
yes exactly, how can a page be refreshed automatically (just need a clue as i am not good at ajax), and can a single element be refreshed

Re: passing elements between pages...how??

Posted: Thu Jan 14, 2010 12:49 pm
by abushahin
ok im not the best at ajax but to start of with you can use php to refresh for u by adding this line after the intended code has been executed,

Code: Select all

<?php echo '<meta http-equiv="Refresh" content="43; url=http://whatever.com" />' ?>;

Re: passing elements between pages...how??

Posted: Fri Jan 15, 2010 3:22 am
by firdous_kind86
thanks for your time..thanks alot

Re: passing elements between pages...how??

Posted: Fri Jan 15, 2010 5:37 am
by abushahin
Hey, no probs just to inform you the content='43' is the time after it will refresh in seconds dnt no why I put that long I usually give it around 2 seconds. Ps. By the way if need any hadith reference, u no where to go, spread the dawah, ws abu

Re: passing elements between pages...how??

Posted: Thu Jan 21, 2010 4:02 am
by carolin
you can use a database and query it..