Hidden Form Field

I have a variable $form that I am trying to display on the screen but also pass the same variable back to the script to be used in the next step.

I tried using a hidden field for the pass back, but it displays the information in the hidden field on the screen so I get the same data posted to the screen twice. It is my understanding that anything posted in a hidden form field, is only seen by the script and not seen on the screen.

Here is the form…

		<TD><form action="maintain.php" method="POST">
        	<input type="hidden" id="hide" name="hide" value="<?php echo ($form); ?>" />
        	<input type="submit" name='formsub' value="New Record" />
        <TD><form action="maintain.php" method="POST">
        	   <input type="submit" name='formsub' value="Search Records" />

<?php echo ($form); ?>

What am I doing wrong???

Uhm, you do realize you are echoing out the value twice don’t you? Once in the hidden field and once after the tables are displayed…

Also, table based layouts belong in the 1990’s. Don’t use them. Do not even get in the habit of using them because once you do it’s a hard habit to break. Tables exist for tabular data, and a form isn’t a table.

Finally understand that you have two forms. Submitting the top one will submit your hidden value, submitting the bottom one will not. When a form is submitted it only submits the values within that specific form and not the values on forms elsewhere on the page.