PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old June 28th, 2004, 07:21 AM
duncan1975 duncan1975 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 4 duncan1975 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
keeping form data when a jump menu refreshes page

I dont know whether this is specifically a php problem, but im using it in these forms anyway.

Ive got a jump menu called "select" which when an options selected it reloads the page with an extra drop down menu below it related to the choice youve made.

<select name="select" onChange="MM_jumpMenu('parent',this,1)">
<option selected>Services...</option>
<option value="corporate_send.php?select=choice">choice
</option>

which then would reload the page....
and anything after this tag would be displayed

<?
if ($select == "choice") {
?>

all this is working fine.

There are several fields before this which lose their data when the page refreshes.

Is there any way of saving/ getting the jump menu to repost the data in these fields when it is selected - so the user doesnt have to type it in again?

any pointers would be fantastic.
thanks
duncan

Reply With Quote
  #2  
Old June 28th, 2004, 07:50 AM
kode_monkey kode_monkey is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 367 kode_monkey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 21 sec
Reputation Power: 6
You could write an on click event for the links that builds a query string sent to the new page and get your php script to re-populate the form from that.

-KM-

Reply With Quote
  #3  
Old June 28th, 2004, 09:11 AM
duncan1975 duncan1975 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 4 duncan1975 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
its the repopulating the fields bit which is confusing me - any ideas?

Reply With Quote
  #4  
Old June 29th, 2004, 09:58 AM
FrankieShakes FrankieShakes is offline
Frank The Tank!
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: Jun 2002
Location: Toronto, Canada
Posts: 1,246 FrankieShakes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via ICQ to FrankieShakes Send a message via MSN to FrankieShakes
Duncan,

I may be wrong here, but how about temporarily storing the data either in an array or in a session object. The event that's called by changing the menu could store the form values just before the page refreshes, and then you can re-populate the fields based on the stored data.

Any other takers on this one? I'd love to hear other suggestions...
__________________
____________________________________________
Developer Shed Weekly Writer | DevArticles Forum Moderator
Build Your Own KlipFolio Klip With PHP
FrankManno.com - Under Construction
Design Interactive Group - Under Construction

Reply With Quote
  #5  
Old June 29th, 2004, 10:22 AM
kode_monkey kode_monkey is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 367 kode_monkey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 21 sec
Reputation Power: 6
I would either create the query string from the data or put it into session data as FrankieShakes suggested. Then when you are creating the form again on the next page you have access to all the information you need to repopulate the form.

For example lets say we use the session data option (so all our variables are in $_SESSION ['var_name']) and we have a variable in there called var1 which we want to put into the first text box in the form. Then when we create the textbox we can add some php to the value property it has to enter in the session data.

Code:
<form blah...>
  <input type="text" name="var1" value="<?php echo $_SESSION ['var1']; ?>" />
</form>


The same code will work for using the query string option by replacing $_SESSION with $_GET instead.

Hope this helps,

-KM-

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > keeping form data when a jump menu refreshes page


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway