Results 1 to 2 of 2

Thread: hide content on page after form submit

  1. #1
    Join Date
    Dec 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default hide content on page after form submit

    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
    PHP Code:
    <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 Code:
    <?php if (isset ($_POST['term']) && $_POST["term"] == 50) { ?>
    <select name="type" id="type">
    <option value="Rent">Rent</option>
    </select>
    <?php ?>
    Last edited by keyboard; 12-16-2012 at 10:45 PM. Reason: Format: Php Tags [php][/php]

  2. #2
    Join Date
    Mar 2011
    Location
    N 11 19' 0.0012 E 142 15' 0
    Posts
    1,531
    Thanks
    41
    Thanked 89 Times in 88 Posts
    Blog Entries
    3

    Default

    Your form's using the post method, so you can access the contents of form elements like this -
    PHP Code:
    $_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)

    PHP Code:
    echo $_POST['termButton']; 

Similar Threads

  1. submit form data to same page
    By danielmeade in forum PHP
    Replies: 1
    Last Post: 02-15-2011, 10:08 PM
  2. Hide Show Div For submit form
    By why not in forum JavaScript
    Replies: 0
    Last Post: 11-10-2010, 11:13 AM
  3. Replies: 36
    Last Post: 05-04-2010, 02:46 AM
  4. show/hide div layer on form submit?
    By moscarda in forum JavaScript
    Replies: 7
    Last Post: 02-15-2008, 10:17 AM
  5. Form action Mailto need to open new page on submit and submit email
    By lstammer in forum Looking for such a script or service
    Replies: 0
    Last Post: 12-06-2007, 05:41 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •