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