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 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Sep 2009
    Posts
    4
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Remember values from <?php echo $PHP_SELF;?>

    Ok, so my form is a price calculator ...

    <html>
    <form method="post" action="<?php echo $PHP_SELF;?>">
    <div class="standardinput">
    <label>Stock:</label>
    <select class="dropdown" name="stock" id="stock">
    <option value="Please Select">Please Select</option>
    <option value="100gsm Bond">100gsm Bond</option>
    <option value="104gsm Expression">104gsm Expression</option>
    <option value="120gsm Knight">120gsm Knight</option>
    <option value="115gsm Envirocare">115gsm Envircare</option>
    </select>
    </div>

    <div class="standardinput">
    <label>Quantity:</label>
    <select class="dropdown" name="qty" id="qty">
    <option value="Please Select">Please Select</option>
    <option value="50">50</option>
    <option value="100">100</option>
    <option value="250">250</option>
    <option value="500">500</option>
    <option value="1000">1000</option>
    <option value="2000">2000</option>
    <option value="2500">2500</option>
    <option value="3000">3000</option>
    <option value="4000">4000</option>
    <option value="5000">5000</option>
    <option value="6000">6000</option>
    <option value="7000">7000</option>
    <option value="8000">8000</option>
    <option value="9000">9000</option>
    <option value="10000">10000</option>
    <option value="Custom">Custom</option>
    </select>
    </div>
    <input name="Submit" type="submit" class="pricebutton" value="Instant Quote" />
    </form>
    </html>

    <php>
    <?php
    $qty = $_POST["qty"];
    $stock = $_POST["stock"];
    ?>
    </php>


    How do I make it so the values created once the "submit" button is pushed, is remember by the drop down form?

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,801
    Thanks
    160
    Thanked 2,216 Times in 2,203 Posts
    Blog Entries
    1
    How do I make it so the values created once the "submit" button is pushed, is remember by the drop down form?
    Take a look at Validate and retain values after validate for drop down menu

    PS: You shouldn't depend upon the ON status of register_globals. See http://php.net/manual/en/security.globals.php and http://www.php.net/manual/en/faq.usi...gister-globals

    And your form is susceptible to XSS attacks, see http://seancoates.com/xss-woes
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • Users who have thanked abduraooft for this post:

    JakeThomas (01-07-2010)

  • #3
    New to the CF scene
    Join Date
    Sep 2009
    Posts
    4
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Thanks!

    I've read the post and It works ...

    I have no idea how you are able to search for these things, I looked on google for about 45 minutes but came up blank.

    I guess if you know what your searching for.

    On another note, I have taken your advice and am going to work on another version of the script thats less vulnerable to attacks.

    Thankyou for the heads up =)

  • #4
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,801
    Thanks
    160
    Thanked 2,216 Times in 2,203 Posts
    Blog Entries
    1
    I've read the post and It works ...

    I have no idea how you are able to search for these things, I looked on google for about 45 minutes but came up blank.

    I guess if you know what your searching for.
    Um.. your confusion is visible from your thread title itself . You'd have looked for "php+retain values in select/drop down form submit"
    Last edited by abduraooft; 01-07-2010 at 09:58 AM.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #5
    Regular Coder
    Join Date
    Dec 2009
    Location
    UK
    Posts
    495
    Thanks
    0
    Thanked 58 Times in 58 Posts
    Also, you shouldn't use PHP_SELF. Its not needed. Simply use action="" and it will send to itself anyway. This is to stop XSS attacks also


  •  

    Posting Permissions

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