How to select a Tab after form submission

How to select a Tab after form submission


Hi,
Newbie here to jQuery. I have a set of tabs in a php page. When the
page loads, the 1st tab always gets selected. What I need to be able
to do is store the currently selected tab on the form submission, then
when the page reloads the last selected tab gets automatically
selected instead of the 1st one.
Not sure how to go about doing this but I have an vague idea:
1. Have jQuery store the selected tab index inside a variable (each
time u select a tab, the variable gets updated to the proper index)
2. Have that tab index written into a hidden input or written to the
document url in order for the php to grab that index number and then
pass it back into the url string once the page reloads
3. Grab that index number on page reload from the document url or
hidden input
4. jQuery then selects that tab
But I have no idea how to go about coding it, I've tried figuring out
how to do it with the UI Tabs documentation but have had no luck.
Thanks,
Ryan