Not 100% sure if this one classes as a php question or is specifically Wordpress...
I'm implementing the Wordpress Settings API with a tabbed settings page. I've added a 'reset tab' button, but since the validation is done on a separate page (options.php) I can't seem to figure out which tab I'm on - without adding the tab as a hidden field, which I want to avoid.
I've found the
wp_get_referer() function, but that gives me the full URL - I'm not sure how to pull the
tab=tab1 out as a variable.
Update - Answer:
$url = parse_url(wp_get_referer()); parse_str($url['query'], $path); $tab = $path['tab'];
As said in the answers, some validation is then required.