passing elements between pages...how??

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
firdous_kind86
Forum Newbie
Posts: 8
Joined: Wed Oct 07, 2009 5:06 am

passing elements between pages...how??

Post 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??
abushahin
Forum Commoner
Posts: 42
Joined: Wed Nov 25, 2009 12:35 pm
Location: london

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

Post 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.
firdous_kind86
Forum Newbie
Posts: 8
Joined: Wed Oct 07, 2009 5:06 am

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

Post 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.
abushahin
Forum Commoner
Posts: 42
Joined: Wed Nov 25, 2009 12:35 pm
Location: london

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

Post 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
firdous_kind86
Forum Newbie
Posts: 8
Joined: Wed Oct 07, 2009 5:06 am

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

Post 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
abushahin
Forum Commoner
Posts: 42
Joined: Wed Nov 25, 2009 12:35 pm
Location: london

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

Post 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" />' ?>;
firdous_kind86
Forum Newbie
Posts: 8
Joined: Wed Oct 07, 2009 5:06 am

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

Post by firdous_kind86 »

thanks for your time..thanks alot
abushahin
Forum Commoner
Posts: 42
Joined: Wed Nov 25, 2009 12:35 pm
Location: london

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

Post 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
carolin
Forum Newbie
Posts: 7
Joined: Thu Jan 21, 2010 3:32 am

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

Post by carolin »

you can use a database and query it..
Post Reply