Okay guys, I am literally pulling my hair out over this one.

I have created a form code appears below.

<FORM action="details_test3.php" method="post"

name="FormName">
<INPUT type="text" name="tbl_name" size="24">
<P><INPUT type="submit" name="_"></P>
</FORM>

This form pass the value typed in the text field to a details page as a variable. This value typed is a name of a table from a mysql database.

Below is the php code that is in the head section of the details page.

<?

$varname = $_POST['tbl_name']

?>

<?php // GoLive Content Source
	   $Tickets = WrapMySQLDatabaseResults("ticketwizard", "select * from $varname where TicketLevel like '%" . pageParameter("TicketLevel","") . "%' and TicketSection like '%" . pageParameter("TicketSection","") . "%' and TicketRow like '%" . pageParameter("TicketRow","") . "%' and TicketSeat like '%" . pageParameter("TicketSeat","") . "%' and TicketStatus like '%" . pageParameter("TicketStatus","") . "%' and TicketFName like '%" . pageParameter("TicketFName","") . "%' and TicketLName like '%" . pageParameter("TicketLName","") . "%'", "block=20","Tickets");
	?>

I added the $varname=$_POST['tbl_name'] to the code which receives the passed variable from the first form.

I also added the $varname in the mysql content source which is replaced by the name typed in the first form.

Everything is working great except a few things. When you type in a name on the first form, lets say Table1 and then click the submit button, the details page is displayed with the records from the proper table.

The Search form on this page work great as well because I have added a the following code in the form

<input type="hidden" name="tbl_name" value="<?php print($varname);?>">

Now here is the problem the next and previous buttons are not working and the update record is not working. When I click on either of these the page displayed is blank. When I view the source code I see the following error Undefined index tbl_name on line 12.

Line 12 is the following PHP code

<?

$varname = $_POST['tbl_name']

?>

Seems to me that once I am on the details page the next, previous and update record buttons are not getting the variable passed to them or the variable does not exist anymore.

Adding the hidden input tag into the form for the next, previous and update record buttons does not work.

I have also tried using isset but get parse errors all over the place.

I have now spent well over 100 hours trying to figure out what is going wrong and I am literally loosing my hair over this.

I also tries the following code in place of the $_POST

$varname = isset($POST["tbl_name"]) ? $POST["tbl_name"] : "";

This code got rid of the Undefined Index error but now I get the following error

call to a member function on a non-object

Below is the entire code for this page

    Okay guys the code is pretty long so I will have to split it ip over to replies.

      <?php require_once("config/include/utils.runtime6.php") ?>
      <?php require_once("config/include/mysql.runtime6.php") ?>

      <html>

      <head>
      	<title>Ticket Wizard</title>
      	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
      	<link href="navigation.css" type="text/css" rel="stylesheet">
      	<link href="main.css" type="text/css" rel="stylesheet">

      <?

      $varname = isset($POST["tbl_name"]) ? $POST["tbl_name"] : "";

      ?>

      <?php // GoLive Content Source
      	   $Tickets = WrapMySQLDatabaseResults("ticketwizard", "select * from $varname where TicketLevel like '%" . pageParameter("TicketLevel","") . "%' and TicketSection like '%" . pageParameter("TicketSection","") . "%' and TicketRow like '%" . pageParameter("TicketRow","") . "%' and TicketSeat like '%" . pageParameter("TicketSeat","") . "%' and TicketStatus like '%" . pageParameter("TicketStatus","") . "%' and TicketFName like '%" . pageParameter("TicketFName","") . "%' and TicketLName like '%" . pageParameter("TicketLName","") . "%'", "block=20","Tickets");
      	?>

      </head>

      <body bgcolor="#ffffe0" leftmargin="0" marginheight="0" marginwidth="0" topmargin="0">
      	<table width="100%" border="0" cellspacing="0" cellpadding="0">
      		<tr bgcolor="#000000">
      			<td width="10"><img src="images/spacer.gif" height="1" width="1"></td>
      			<td width="185"></td>
      			<td align="center" width="12"><img src="images/vertical_line.gif" height="44" width="5"></td>
      			<td class="BreadCrumb">
      				<p><a class="BreadCrumb-Link" href="details_test2.php"><img src="images/triangle.gif" height="7" width="4" align="absmiddle" border="0"> Table of Contents</a> | <b>Ticket Wizard Search Engine</b></p>
      			</td>
      		</tr>
      		<tr>
      			<td colspan="4" bgcolor="#333333" height="1"><img src="images/spacer.gif" height="1" width="1"></td>
      		</tr>
      		<tr>
      			<td colspan="4" bgcolor="#666666" height="1"><img src="images/spacer.gif" height="1" width="1"></td>
      		</tr>
      		<tr bgcolor="#999999" height="25">
      			<td width="10" height="25"><img src="images/spacer.gif" height="1" width="1"></td>
      			<td class="SiteTitle" colspan="3" height="25">Ticket Wizard by ATG Internet</td>
      		</tr>
      		<tr>
      			<td bgcolor="#ffffff" width="10" height="20"><img src="images/spacer.gif" height="1" width="1"></td>
      			<td colspan="3" bgcolor="#ffffff" height="20"><img src="images/spacer.gif" height="1" width="1"></td>
      		</tr>
      	</table>
      	<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="white">
      		<tr>
      			<td rowspan="3" width="10" height="22"><img src="images/spacer.gif" height="1" width="1"></td>
      			<td rowspan="3" valign="top" bgcolor="#669966" width="1" height="22"><img src="images/nav/main_L_1.gif" height="22" width="5"></td>
      			<td bgcolor="#669966" width="140"><img src="images/spacer.gif" height="1" width="1"></td>
      			<td rowspan="3" valign="top" bgcolor="#669966" width="1" height="22"><img src="images/nav/main_R_10.gif" height="22" width="5"></td>
      			<td width="140" height="1"><img src="images/spacer.gif" height="1" width="1"></td>
      			<td rowspan="3" valign="top" bgcolor="#9bbccc" width="1" height="22"><img src="images/nav/admin_R_00.gif" height="22" width="5"></td>
      			<td width="140" height="1"><img src="images/spacer.gif" height="1" width="1"></td>
      			<td rowspan="3" valign="top" bgcolor="#9999cc" width="1" height="22"><img src="images/nav/howto_R_0.gif" height="22" width="5"></td>
      			<td rowspan="3" height="22"><img src="images/spacer.gif" height="1" width="1"></td>
      		</tr>
      		<tr>
      			<td bgcolor="#b6deb6" width="140" height="1"><img src="images/spacer.gif" height="1" width="1"></td>
      			<td bgcolor="#9bbccc" width="140" height="1"><img src="images/spacer.gif" height="1" width="1"></td>
      			<td bgcolor="#9999cc" width="140" height="1"><img src="images/spacer.gif" height="1" width="1"></td>
      		</tr>
      		<tr>
      			<td class="NavigationTab" align="center" valign="middle" bgcolor="#669966" width="140" height="20"><b>&nbsp;Main Website&nbsp;View&nbsp;</b></td>
      			<td class="NavigationTab" align="center" valign="middle" bgcolor="#9bbccc" width="140" height="20">&nbsp;Administration&nbsp;View&nbsp;</td>
      			<td class="NavigationTab" align="center" valign="middle" bgcolor="#9999cc" width="140" height="20">&nbsp;How&nbsp;it&nbsp;Works&nbsp;</td>
      		</tr>
      		<tr>
      			<td colspan="9" bgcolor="#669966" height="1"><img src="images/spacer.gif" height="1" width="1"></td>
      		</tr>
      		<tr>
      			<td colspan="9" bgcolor="#b6deb6" height="1"><img src="images/spacer.gif" height="1" width="1"></td>
      		</tr>
      	</table>
      	<table width="100%" border="0" cellspacing="0" cellpadding="10">
      		<tr valign="top">
      			<td bgcolor="#FAFAFA" width="25%">Current Events in the Ticket&nbsp;Wizard Database.
            <P></P>
            <P><? 

      $db = mysql_connect("localhost","username","password");

      mysql_select_db ("databasename");

      $q = mysql_query("show tables");
      while ($row = mysql_fetch_row($q)) {
      echo "$row[0]<br>";
      }

      {
      mysql_close($db);
      }

      ?> </Font></P><BR>
      <FORM action="details_test3.php" method="post" name="FormName">
      <INPUT type="text" name="tbl_name" size="24">
      <P><INPUT type="submit" name="_"></P>
      </FORM>
      </td>
      <td width="90%">
      <h1></h1>
      <H1></H1>
      <h2>Use the search boxs below to find and update tickets in your datatbase.</h2>
      <FORM action="details_test3.php" method="post" name="FormName">
      <input type="hidden" name="tbl_name" value="<?php print($varname);?>">
      <P><SELECT name="TicketLevel">
      <OPTION value="">Select Level</OPTION>
      <OPTION value="Orchestra">Orchestra</OPTION>
      <OPTION value="Terrace">Terrace</OPTION>
      <OPTION value="Balcony">Balcony</OPTION>
      </SELECT></P>
      <P><SELECT name="TicketSection">
      <OPTION value="">Select Section</OPTION>
      <OPTION value="A">A</OPTION>
      <OPTION value="B">B</OPTION>
      <OPTION value="C">C</OPTION>
      <OPTION value="D">D</OPTION>
      <OPTION value="E">E</OPTION>
      <OPTION value="F">F</OPTION>
      <OPTION value="G">G</OPTION>
      </SELECT></P>
      <P><SELECT name="TicketRow">
      <OPTION value="">Select Row</OPTION>
      <OPTION value="A">A</OPTION>
      <OPTION value="B">B</OPTION>
      <OPTION value="C">C</OPTION>
      <OPTION value="D">D</OPTION>
      <OPTION value="E">E</OPTION>
      <OPTION value="F">F</OPTION>
      <OPTION value="G">G</OPTION>
      <OPTION value="H">H</OPTION>
      <OPTION value="I">I</OPTION>
      <OPTION value="J">J</OPTION>
      <OPTION value="K">K</OPTION>
      <OPTION value="L">L</OPTION>
      <OPTION value="M">M</OPTION>
      <OPTION value="N">N</OPTION>
      <OPTION value="O">O</OPTION>
      <OPTION value="P">P</OPTION>
      <OPTION value="Q">Q</OPTION>
      <OPTION value="R">R</OPTION>
      <OPTION value="S">S</OPTION>
      <OPTION value="T">T</OPTION>
      <OPTION value="U">U</OPTION>
      </SELECT></P>
      <P><SELECT name="TicketSeat">
      <OPTION value="">Select Seat</OPTION>
      <OPTION value="01">1</OPTION>
      <OPTION value="02">2</OPTION>
      <OPTION value="03">3</OPTION>
      <OPTION value="04">4</OPTION>
      <OPTION value="05">5</OPTION>
      <OPTION value="06">6</OPTION>
      <OPTION value="07">7</OPTION>
      <OPTION value="08">8</OPTION>
      <OPTION value="09">9</OPTION>
      <OPTION value="10">10</OPTION>
      <OPTION value="11">11</OPTION>
      <OPTION value="12">12</OPTION>
      <OPTION value="13">13</OPTION>
      <OPTION value="14">14</OPTION>
      </SELECT></P>
      <P><INPUT type="text" name="TicketFName" size="24">First Name</P>
      <P><INPUT type="text" name="TicketLName" size="24">Last Name</P>
      <P><SELECT name="TicketStatus">
      <OPTION value="">Select Status</OPTION>
      <OPTION value="Available">Available</OPTION>
      <OPTION value="Sold">Sold</OPTION>
      <OPTION value="Season">Season</OPTION>
      <OPTION value="NoSale">NoSale</OPTION>
      </SELECT><INPUT class="MainButton" type="submit" name="submitButtonName" value="Search for Tickets"></P>
      </FORM>
      <H2></H2>

        <FORM action='config/actions/mysql.actions6.php?<?php echo URLArgs(array())?>' method="post" name="FormName">
        <input type="hidden" name="tbl_name" value="<?php print($varname);?>">
        <DIV align="center">

                </DIV>

        // The line below is returning the error call to a member funtion on non-object

                <P><B><?php echo $Tickets->RecordCount()?></B> Tickets found.</P>
                <TABLE width="80%" border="0" cellspacing="2" cellpadding="0">
                  <TR>
                    <TD><A <?php echo LinkToPreviousRecord($Tickets)?>>&lt;&lt;Previous Page</A></TD>
                    <TD>
                      <DIV align="right">
                        <A <?php echo LinkToNextRecord($Tickets)?>>Next Page&gt;&gt;</A></DIV>
                    </TD>
                  </TR>
                </TABLE>
                <TABLE width="80%" border="0" cellspacing="0" cellpadding="4">
                  <TR>
                    <TD class="TableRow" width="41">Level</TD>
                    <TD class="TableRow" width="42">Section</TD>
                    <TD class="TableRow" nowrap width="22">Row</TD>
                    <TD class="TableRow" nowrap width="23">Seat#</TD>
                    <TD class="TableRow" nowrap width="157">First Name</TD>
                    <TD class="TableRow" nowrap width="157">Last Name</TD>
                    <TD class="TableRow" nowrap width="86">Status</TD>
                  </TR>
                </TABLE>
                <TABLE width="80%" border="0" cellspacing="0" cellpadding="4">
        						<?php $Tickets->MoveFirst(); ?>
        						<?php $Tickets->Move($Tickets->FirstRecordOnPage() - 1); ?>
        						<?php while (!$Tickets->EOF() && !$Tickets->EOB()) { ?>
        						<TR>
                    <TD <?php echo Alternate($Tickets->AbsolutePosition(), "class", "1:ColumnItem,1:ColumnItemAlt")?> width="41"><?php echo $Tickets->Value("TicketLevel")?></TD>
                    <TD <?php echo Alternate($Tickets->AbsolutePosition(), "class", "1:ColumnItem,1:ColumnItemAlt")?> width="42"><?php echo $Tickets->Value("TicketSection")?></TD>
                    <TD <?php echo Alternate($Tickets->AbsolutePosition(), "class", "1:ColumnItem,1:ColumnItemAlt")?> nowrap width="22"><?php echo $Tickets->Value("TicketRow")?></TD>
                    <TD <?php echo Alternate($Tickets->AbsolutePosition(), "class", "1:ColumnItem,1:ColumnItemAlt")?> nowrap width="23"><?php echo $Tickets->Value("TicketSeat")?></TD>
                    <TD <?php echo Alternate($Tickets->AbsolutePosition(), "class", "1:ColumnItem,1:ColumnItemAlt")?> nowrap width="157"><INPUT type="text" name='TicketFName(<?php echo $Tickets->AbsolutePosition()?>)' value='<?php echo fixHTMLquotes($Tickets->Value("TicketFName")) ?>' size="24"></TD>
                    <TD <?php echo Alternate($Tickets->AbsolutePosition(), "class", "1:ColumnItem,1:ColumnItemAlt")?> nowrap width="157"><INPUT type="text" name='TicketLName(<?php echo $Tickets->AbsolutePosition()?>)' value='<?php echo fixHTMLquotes($Tickets->Value("TicketLName")) ?>' size="24"></TD>
                    <TD <?php echo Alternate($Tickets->AbsolutePosition(), "class", "1:ColumnItem,1:ColumnItemAlt")?> nowrap width="102"><SELECT name='TicketStatus(<?php echo $Tickets->AbsolutePosition()?>)' size="1">
                        <OPTION value="Available"         <?php echo selected($Tickets->Value("TicketStatus") == "Available") ?>>Available</OPTION>
                        <OPTION value="Sold"         <?php echo selected($Tickets->Value("TicketStatus") == "Sold") ?>>Sold</OPTION>
                        <OPTION value="Season"         <?php echo selected($Tickets->Value("TicketStatus") == "Season") ?>>Season</OPTION>
                        <OPTION value="NoSale"         <?php echo selected($Tickets->Value("TicketStatus") == "NoSale") ?>>NoSale</OPTION>
                      </SELECT></TD>
                  </TR>
        						<?php $Tickets->MoveNext(); ?>
        						<?php } ?>
                </TABLE>
        
                <TABLE width="80%" border="0" cellspacing="2" cellpadding="0">
                  <TR>
                    <TD><A <?php echo LinkToPreviousRecord($Tickets)?>>&lt;&lt;Previous Page</A></TD>
                    <TD>
                      <DIV align="right">
                        <A <?php echo LinkToNextRecord($Tickets)?>>Next Page&gt;&gt;</A></DIV>
                    </TD>
                  </TR>
                </TABLE>
                <DIV align="center">
                  <P><INPUT type="submit" name="_SubmitChanges"           <?php SetupMySQLUpdate('$return', '$return', $Tickets) ?>></P>
                </DIV>
        					<?php SetupMySQLForm($Tickets); ?>
        
              </FORM>
              <p></p>
              <DIV align="center">
                <P></P>
              </DIV>
            </td>
        		</tr>
        	</table>
        </body>

        </html>

        <?php if (false) { ?><!-- Mock Content
        "Tickets/$recordCount" html {16}
        "Tickets/<TABLE>" html {$$ltTR$$gt$$ltTD class="ColumnItemAlt" width="41"$$gt$$lt/TD$$gt$$ltTD class="ColumnItemAlt" width="42"$$gt$$lt/TD$$gt$$ltTD class="ColumnItemAlt" nowrap width="22"$$gt$$lt/TD$$gt$$ltTD class="ColumnItemAlt" nowrap width="23"$$gt$$lt/TD$$gt$$ltTD class="ColumnItemAlt" nowrap width="157"$$gt$$lt/TD$$gt$$ltTD class="ColumnItemAlt" nowrap width="157"$$gt$$lt/TD$$gt$$ltTD class="ColumnItemAlt" nowrap width="102"$$gt$$lt/TD$$gt$$lt/TR$$gt}
        "Tickets/TicketLevel" html {X}
        "Tickets/TicketSection" html {X}
        "Tickets/TicketRow" html {X}
        "Tickets/TicketSeat" html {X}
        "Tickets/TicketFName" text {}
        "Tickets/TicketLName" text {}
        --><?php } ?>

          well i think i was trying to solve this yesterday, the problem is that tbl_name does not move onto the page when u use next and previous links,

          the issue in the code is functions are called to generate the next and previous links

          LinkToPreviousRecord($Tickets)
          LinkToNextRecord($Tickets)

          you havent posted the code for the functions [ i guess its a class ], and it seems you have to modify the code in the functions.

          i had asked if u inherited this code or if you had written it from scratch for that reason.

          i had also suggested you use session to register the tbl_name variable.

          also your form is like this

          <FORM action='config/actions/mysql.actions6.php?<?php echo URLArgs(array())?>' method="post" name="FormName">

          what does URLArgs(array()) do ....

          EDIT : just read the reply to the other post, just write your own code from scratch, and dump golive!

          reg
          kevin

            I'm sorry kevin

            The code is generated by Adobe go-live with a little bit of code added in myself. I am thinking that I will have to write all code form scratch becasue all code I have written is working and all code generated by Go-Live is not.

            <FORM action='config/actions/mysql.actions6.php?<?php echo URLArgs(array())?>'

            The url here is refering to a php file generated by Adobe go-live

            THere are numerous files that adobe generates way to long to post here. I am not sure what needs to be done.

            The code you gave me yesterday might work but I keep getting parse errors with it below is the code you gave me yesterday.

            if(isSet($POST['tbl_name')){
            $varname = $
            POST['tbl_name');
            }else{
            $varname = $_GET['tbl_name');
            }

            This code keeps returning parse errors

            Not sure what to do now.

              Write a Reply...