Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Sep 2006
    Posts
    216
    Thanks
    9
    Thanked 0 Times in 0 Posts

    posting to the current page

    hello,

    Is it possible to post a value to the current page and display it when the page reloads?. For example if I am on 'page1.php' and usign a form to post a variable to 'page1.php', would this be possible. Possible code below: Any other suggestions if this wouldn't work??

    This is code for page1.php

    Code:
    <?php
    echo $_POST['selection'];
    ?>
    
    
    <form action="page1.php" method="post">
    <select size=1 name="selection"  onchange="this.form.submit();">
    <option value="goalkeeper">Goalkeeper</option>
    </select>
    </form>

  • #2
    Regular Coder
    Join Date
    Nov 2006
    Posts
    247
    Thanks
    13
    Thanked 26 Times in 24 Posts
    Code:
    <?php
    echo $_POST['selection'];
    ?>
    
    
    <form action="<? $_SERVER[PHP_SELF] ?>" method="POST">
    <select size=1 name="selection"  onchange="this.form.submit();">
    <option value="goalkeeper">Goalkeeper</option>
    </select>
    </form>
    That should do it.

  • #3
    TrainReq
    Guest
    Code:
    <form method="POST">
    Can also make it post as well


  •  

    Posting Permissions

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