Return focus to spry tab
Hi,
I know this has been asked previously and I have gone thorugh the posts day after day trying to figure them but am having no luck at all.
Would appreciate someone in the know looking at my code and pointing me in the right direction..
I have an admin section to my site which contains 8 Spry tabs, each one containing a form that I can sue to update my database. I am trying to get the "Submit" button to return me to the tab I was working on but so far either get returnd to the default page or the tabs themselves stop working.. Each seperate tab will have it's own form and so far cannot get even one to work
. Can someone advise please.. code below for my admin page. The code I have inserted relating to the Spry tabs I have placed in bold here ..
Any help will be greatly appreciated..
Regards,
gyesdahl
***************** CODE*************
<?php require_once('../Connections/la.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form2")) {
$insertSQL = sprintf("INSERT INTO days (name) VALUES (%s)",
GetSQLValueString($_POST['day'], "text"));
//////////// MY INSERT //////////////////////
$tabToShow = 7; // 2 = 3rd tab
//////////////////////////////////////////////
mysql_select_db($database_la, $la);
$Result1 = mysql_query($insertSQL, $la) or die(mysql_error());
$insertGoTo = "admin.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "" : "";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
mysql_select_db($database_la, $la);
$query_days = "SELECT days.name FROM days";
$days = mysql_query($query_days, $la) or die(mysql_error());
$row_days = mysql_fetch_assoc($days);
$totalRows_days = mysql_num_rows($days);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/sub.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Untitled Document</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<script src="../SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script>
<script type="text/javascript" src="../SpryAssets/SpryURLUtils.js"></script>
<link href="../SpryAssets/SpryTabbedPanels.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
// Grabs the values of the URL parameters for the current URL.
var params = Spry.Utils.getLocationParamsAsObject();
</script>
<!-- InstanceEndEditable -->
<style type="text/css">
<!--
@1552174 url("../la.css");
body {
background-color: #000033;
font-family: "Times New Roman", Times, serif;
font-size: 12px;
color: #CC6666;
}
.style1 {font-size: 12px}
.links {color: #CCCC66}
-->
</style>
<link href="backup/styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="65%" height="430" border="3" align="center" bordercolor="#666666" bgcolor="#FFFFFF">
<tr>
<td valign="top"><table width="100%" height="134" border="0" align="center" bordercolor="#FFFFFF" bgcolor="#FFFFFF">
<tr>
<td width="523" height="72" align="center" valign="top"><div align="left"><img src="../Images/logo.jpg" width="259" height="72" /></div></td>
<td width="1" height="72"> </td>
<td width="200
" height="72" border="2" bordercolor="#000033"><div align="center"><img src="images/la<?php echo rand(1,10); ?>.jpg" width="159" height="72" /></div></td>
</tr>
<tr align="center" valign="top">
<td height="23" colspan="3" bgcolor="#993300"><div align="center" class="links"><a href="../index.php">Home</a> | About Us | Contact Us | Tours | Air Charter | Managed Properties
<div align="right" style="font-size: 8pt;">
<div align="center"><b><?php echo date("l d M Y"); ?></b></div>
</div>
</div></td>
</tr>
<tr align="center" valign="top">
<th height="17" colspan="3" background="backup/images/sub_feature.jpg"> </th>
</tr>
</table>
<hr align="center" width="100%" size="2" class="brown" />
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left"></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="610" valign="top"><!-- InstanceBeginEditable name="Sub_main" -->
<div id="TabbedPanels1" class="TabbedPanels">
<ul class="TabbedPanelsTabGroup">
<li class="TabbedPanelsTab" tabindex="0">View Tours</li>
<li class="TabbedPanelsTab" tabindex="0">Create Tour</li>
<li class="TabbedPanelsTab" tabindex="0">Delete Tour</li>
<li class="TabbedPanelsTab" tabindex="0">Add Country</li>
<li class="TabbedPanelsTab" tabindex="0">Inclusions</li>
<li class="TabbedPanelsTab" tabindex="0">Exclusions</li>
<li class="TabbedPanelsTab" tabindex="0">Currency</li>
<li class="TabbedPanelsTab" tabindex="0">Days</li>
</ul>
<div class="TabbedPanelsContentGroup">
<div class="TabbedPanelsContent" style="display: none">Content 1</div>
<div class="TabbedPanelsContent" style="display: block">Content 2</div>
<div class="TabbedPanelsContent" style="display: none">Content 3</div>
<div class="TabbedPanelsContent" style="display: none">Content 4</div>
<div class="TabbedPanelsContent" style="display: none">Content 5</div>
<div class="TabbedPanelsContent" style="display: none">Content 6</div>
<div class="TabbedPanelsContent" style="display: none">Content 7</div>
<div class="TabbedPanelsContent" style="display: none">
<form action="admin.php" method="post" name="form2" id="form2">
<table align="center">
<tr valign="baseline">
<td nowrap="nowrap" align="right">Day:</td>
<td><p>
<input type="text" name="day" value="" size="32" />
</p>
<p>
<input type="submit" name="button" id="button" value="Submit" />
</p></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right"> </td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form2" />
</form>
<p> </p>
ontent 8</div>
</div>
</div>
<div align="center"></div>
<script type="text/javascript">
HAVE TRIED BOTH OF THE BELOW CODES WITH NO RESULTS. EITHERE RETURNS TO DEFAULT (0) TAB OR THE TABS STOP WORKING
<!--
var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1",{defaultTab:<?php echo($tabToShow);?> });
//-->
</script>
<script type="text/javascript">
<!--
//var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1", {defaultTab:(params.panel ? params.panel :7 )});
//-->
</script>
<!-- InstanceEndEditable --></td>
</tr>
</table>
<p> </p></td>
</tr>
<tr>
<td valign="top"><div align="center" class="style1">Copyright © 2009 Leisure Africa - All Rights Reserved</div></td>
</tr>
</table>
<p> </p>
</body>
<!-- InstanceEnd --></html>
<?php
mysql_free_result($days);
?>
