Linux Format forums Forum Index Linux Format forums
Help, discussion, magazine feedback and more
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Keeping some selected options after submitting form

 
Post new topic   Reply to topic    Linux Format forums Forum Index -> Programming
View previous topic :: View next topic  
Author Message
guy13



Joined: Wed Apr 13, 2005 8:39 pm
Posts: 47
Location: Belgium

PostPosted: Fri Mar 28, 2014 11:26 am    Post subject: Keeping some selected options after submitting form Reply with quote

Hi all,

Thanks in advance for any suggestions on the following:

I've created a php-page to add works from composers to CDs. It's a combination of two forms and looks like this:

1st form:
Composer : [drop down list] : Select

Some blank space

2nd form:
Title : [drop down list]
Track number : [empty field]
Work : [drop down list]
+ some other fields

Process button

After selecting a name in the first block (posting to $_SERVER["PHP_SELF"]) I stay on the same page and that name is shown in the blank space in between and the drop down lists are populated with only CD titles and works of the selected composer.

I can then select from the lists and enter other data in the other fields. Hitting the process button posts the data from the second block to another page which will eventually send everything to a table in a MySQL database.

After that I send myself back to the first page with header("Location: the_first_page.php")

So far so good, but upon returning I would like the composer, title and work to be preselected. Now I'm sent to a blank page and have to start from scratch. I think I've seen some solution involving testing $_POST['something'] against <option value> in a drop down list but I can't seem to make that work. My question is: is there a way to send $_POST['Title'] and $_POST['Work'] back to the first page somehow? Or is it better to split the two forms over seperate pages?

All help is welcome.
Back to top
View user's profile Send private message
View previous topic :: View next topic  
Display posts from previous:   
Post new topic   Reply to topic    Linux Format forums Forum Index -> Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Linux Format forums topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group


Copyright 2011 Future Publishing, all rights reserved.


Web hosting by UKFast