Advertisement

08.19.2008 at 01:42PM PDT, ID: 23661124
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.2

Passing of PHP variable in Spry Tabs

Asked by efolb in PHP for Windows, PHP Scripting Language, PHP and Databases

Tags: ,

I have two Spry tabs.  The first has a table in which after the user clicks on a field would open the second tab containing more information based on the selection.  It is a one-to-many relantionship in which tab 1 is the main record detail and tab 2 is the detail records of the first table.

I have tried to hyperlink to a PHP function that would save the PID of the selected main record and then call the tab 2 to be open.  This works except the variable record_id is changing in the PHP function but does not retain its value in the tab 2 code.  Therefore I do not get the proper results.  I have even tried the dreaded $GLOBALS with no luck.

I have included the tab1 and tab 2 snippets and the PHP function.Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
function secondtab($passRecord)
{
$record_id =  $passRecord;
?>
javascript:TabbedPanels1.showPanel(1);
<?php
}
?>
 
 
<body>
 
<div id="TabbedPanels1" class="TabbedPanels">
  <ul class="TabbedPanelsTabGroup">
    <li class="TabbedPanelsTab" tabindex="1">Staff</li>
    <li class="TabbedPanelsTab" tabindex="2">HR</li>
    </ul>
    <div class="TabbedPanelsContentGroup">
      <div class="TabbedPanelsContent">
      <form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
      <table border="1" align="center">
      <tr>
      <!--<td>pid</td>-->
      <td>lastname</td>
      <td>advregion</td>
      <td>region</td>
      <td>status</td>
      </tr>
    
	  <?php do { ?>
      <tr>      
      <td><?php echo $row_Family['lastname']; ?> &nbsp; </td>
      <td><a href="<?php secondtab($row_Family['pid']);?>"> <?php echo $row_Family['advregion']; ?>&nbsp; </a> </td>
      <td><?php echo $row_Family['region']; ?>&nbsp; </td>
      <td><?php echo $row_Family['status']; ?>&nbsp; </td>
      </tr>
      <?php } while ($row_Family = mysql_fetch_assoc($Family)); ?>
      </table>
</form>
    </div>
 
    <!--Second Tab HR --> 
    <div class="TabbedPanelsContent">
      <form id="form1" name="form1" method="post" action="">
        <?php
									
      	$maxRows_DetailRS1 = 10;
		$pageNum_DetailRS1 = 0;
		if (isset($_GET['pageNum_DetailRS1'])) {
		  $pageNum_DetailRS1 = $_GET['pageNum_DetailRS1'];
		}
		$startRow_DetailRS1 = $pageNum_DetailRS1 * $maxRows_DetailRS1;
		
		$colname_DetailRS1 = "-1";
		if (isset($_GET['recordID'])) {
		  $colname_DetailRS1 = $_GET['recordID'];
		}
		
		mysql_select_db($database_CAI, $CAI);
		
				      
		$query_DetailRS1 = sprintf("SELECT * FROM hr WHERE pid = %d ORDER BY lastname ASC",$record_id);
		
		$query_limit_DetailRS1 = sprintf("%s LIMIT %d, %d", $query_DetailRS1, $startRow_DetailRS1, $maxRows_DetailRS1);
		$DetailRS1 = mysql_query($query_limit_DetailRS1, $CAI) or die(mysql_error());
		$row_DetailRS1 = mysql_fetch_assoc($DetailRS1);
		
		if (isset($_GET['totalRows_DetailRS1'])) {
		  $totalRows_DetailRS1 = $_GET['totalRows_DetailRS1'];
		} else {
		  $all_DetailRS1 = mysql_query($query_DetailRS1);
		  $totalRows_DetailRS1 = mysql_num_rows($all_DetailRS1);
		}
		$totalPages_DetailRS1 = ceil($totalRows_DetailRS1/$maxRows_DetailRS1)-1;
		
		$queryString_DetailRS1 = "";
		if (!empty($_SERVER['QUERY_STRING'])) {
		  $params = explode("&", $_SERVER['QUERY_STRING']);
		  $newParams = array();
		  foreach ($params as $param) {
			if (stristr($param, "pageNum_DetailRS1") == false && 
				stristr($param, "totalRows_DetailRS1") == false) {
			  array_push($newParams, $param);
			}
		  }
		  if (count($newParams) != 0) {
			$queryString_DetailRS1 = "&" . htmlentities(implode("&", $newParams));
		  }
		}
		$queryString_DetailRS1 = sprintf("&totalRows_DetailRS1=%d%s", $totalRows_DetailRS1, $queryString_DetailRS1);
		?>
       Text 
       <table border="1" align="center">
            <tr>
              <td>PID</td>
              <td>Last Name</td>
              <td>File</td>
              <td>File Description</td>
              <td>Level</td>
            </tr>
            <?php do { ?>
            <tr>      
              <td><?php echo $row_DetailRS1['pid'];?> &nbsp; </td>
              <td><?php echo $row_DetailRS1['lastname']; ?> &nbsp; </td>
              <td><?php echo $row_DetailRS1['file']; ?>&nbsp; </td>
              <td><?php echo $row_DetailRS1['filedescript']; ?>&nbsp; </td>
              <td><?php echo $row_DetailRS1['level']; ?>&nbsp; </td>
            </tr>
            <?php } while ($row_DetailRS1 = mysql_fetch_assoc($DetailRS1)); ?>
          </table>
 
Loading Advertisement...
 
[+][-]08.20.2008 at 02:03AM PDT, ID: 22267376

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: PHP for Windows, PHP Scripting Language, PHP and Databases
Tags: PHP Spry, FireFox
Sign Up Now!
Solution Provided By: fibo
Participating Experts: 1
Solution Grade: A
 
 
[+][-]08.22.2008 at 07:07AM PDT, ID: 22290118

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.22.2008 at 10:40AM PDT, ID: 22292287

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628