Log in

View Full Version : hide content on page after form submit



shoapin_bajan
12-16-2012, 06:02 PM
I'm new to php, using dreamweaver. I hope someone can help me with this problem. I have a form on my tables.php that inserts values into a database using the insert behaviour from dreamweaver which works fine.

i want to use the contents from one of the hidden input fields from that form to manipulate the look of another page called listing.php. Is this possible? Any help will be appreciated. Thanks in advance.

Here's the code:

tables.php

<td width="160" class="amount"><form action="<?php echo $editFormAction; ?>" method="POST" name="shortTerm" id="shortTerm">
<input name="short" type="hidden" id="short" value="<?php echo $_SESSION['MM_UserGroup']; ?>">
<input name="term" type="hidden" id="term" value="50">
<input type="submit" name="termButton" id="termButton" value="$50 USD">
<input type="hidden" name="MM_insert" value="shortTerm">
</form></td>

listing.php


<?php if (isset ($_POST['term']) && $_POST["term"] == 50) { ?>
<select name="type" id="type">
<option value="Rent">Rent</option>
</select>
<?php } ?>

keyboard
12-16-2012, 10:49 PM
Your form's using the post method, so you can access the contents of form elements like this -

$_POST['NAME_OF_ELEMENT'];

So, assuming that tables.php submits to listing.php, you can echo the contents of the input "termButton" (an example) like this - (this code would go on listing.php)


echo $_POST['termButton'];