I have the following js function and code (I am not the creator of the function):
Code: Select all
<script type="text/javascript">
function tab(id){
document.getElementById('tab_Tab #1').className = 'tab_inactive';
document.getElementById('tabcontent_Tab #1').style.display = 'none';
document.getElementById('tab_Tab #2').className = 'tab_inactive';
document.getElementById('tabcontent_Tab #2').style.display = 'none';
document.getElementById('tab_'+id).className = 'tab_active';
document.getElementById('tabcontent_'+id).style.display = '';
}
</script>
<DIV CLASS='tab_active' ID='tab_Tab #1' onClick="tab('Tab #1');"><font face="verdana" size=2>1</font></DIV>
<DIV CLASS='tab_inactive' ID='tab_Tab #2' onClick="tab('Tab #2');"><font face="verdana" size=2>2</font></DIV>
<DIV STYLE='float: left; clear:both;'></DIV>
<DIV ID = 'tabcontent_Tab #1' CLASS='tab_content' STYLE='display: block;'>
<table>
<?
...cod..
?>
</table>
</DIV>
<DIV ID = 'tabcontent_Tab #2' CLASS='tab_content' STYLE='display: none;'>
<table>
<tr>
<form name="x" method=post><td><input name="x" type=submit value="OK"></td></form>
</tr>
</table>
</DIV>
When I submit a form from the second tab, the page refresh and it moves back to the first tab.
How can it be done so that after refresh, it returns automatically on the second tab (or any other tab wished if there are more then 2 tabs)?
Code: Select all
if(isset($_POST['x']))
{
$some_stuff_here;
echo "action complete <meta http-equiv=\"refresh\" content=\"3\">";
// and here i need some (php) code that will return the page to the wanted tab...
// if I have several forms on a page, depending on the submit, the page must returs to the desired tab
}Thanks,
Alex