PHP tabs save on link click

WannaFly

Platinum Member
Jan 14, 2003
2,811
1
0
Im writing an application with a tab like interface that will store each of the tabs data into a database. My problem is I want the user to be able to "move" between the tabs and it save the data on each as they move between them. Currently,the tabs are just anchors. I COULD put next/previous buttons, but i'd really like to stick with the tab interface.

Quick google search didnt reveal anything. Does anyone have any idea how to do something like this?

I've thought about making a "gateway" for each link so the links could be something like
gateway.php?from=page1&to=page2, but this wouldnt post the data and save it to the database.

If i dont figure anything out i might have to drop my neat tab design
 

jjones

Lifer
Oct 9, 2001
15,425
2
0
Are you saying that there is form data on each page and as they tab through, you want to post that form data? If so, why not use the tab as your submit button?

Here's how I would likely do it: One page using includes to fill out the body of each tab page. Your tabs are all submit buttons with different values (page1, page 2, etc) posting back to the same page. Use the empty function to check the post array to verify if you want to send data to the DB or not, excluding the value of the submit field of course.

That way when someone clicks on page2, you know that's the include you want and you also know that that's the tab that will be in focus when the page comes up. With CSS you can make a submit field act and look almost exactly like an anchor.
 

ugh

Platinum Member
Feb 6, 2000
2,563
0
0
Instead of linking the tabs that way, each tab click will have to be a form submission to an action in your PHP script to perform the saving of form data. For example the link in Tab1 would be <a href="javascript:saveInfo('tab1')">Tab 1</a>. The saveInfo JavaScript function will perform the necessary logic to post back to the PHP script to save the details in session or which ever convenient place.
 

Atheus

Diamond Member
Jun 7, 2005
7,313
2
0
Originally posted by: jjones
Are you saying that there is form data on each page and as they tab through, you want to post that form data?

I don't think so, I think he's saying he wants to preserve the data on each tab as the user clicks through, and then allow submission of each of them independently. Is that right OP?

I would do the tabs in one page, make them all divs with DHTML changing the z-index when you click through them, and do an xmlhttprequest 'AJAX' save function on each tab.

 

WannaFly

Platinum Member
Jan 14, 2003
2,811
1
0
Originally posted by: Atheus
Originally posted by: jjones
Are you saying that there is form data on each page and as they tab through, you want to post that form data?

I don't think so, I think he's saying he wants to preserve the data on each tab as the user clicks through, and then allow submission of each of them independently. Is that right OP?

I would do the tabs in one page, make them all divs with DHTML changing the z-index when you click through them, and do an xmlhttprequest 'AJAX' save function on each tab.


Thanks for all the input everyone, it's very valueable. I'd rather not preserve the data, i'd rather post it and save it to the DB upon tab change and recall it if they go back to that tab.

I didnt think of using javascript to post the info on page change, thats a good idea, just wish i could find some similar examples online. I'm a bit rusty, havent done PHP in 5 or so years, and ASP.NET has spoiled me.
 

jjones

Lifer
Oct 9, 2001
15,425
2
0
Well, you can do it that way, but with basic php functions, html and a little css you can do exactly what you want. No need to find a javascript to handle your post data, or work with dhtml or ajax. Write a simple little function to handle your tab focus based on the submit value and you're all set. It's clean and uncomplicated, my preferred method.
 

troytime

Golden Member
Jan 3, 2006
1,996
1
0
i would do the divs with dhtml

use the jquery library for easy ajax functionality
you need 2 javascript functions and 2 php scripts

simple, slick, effective
 
sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |