$_POST variables help please

Discussion in 'PHP' started by gordi555, Feb 29, 2008.

  1. #1
    I have a page which get's it values from a POST method.

    Basically...

    I want to allow people entering discount codes and then repost all the post varibles to the current page again so I can process any codes that where added.

    Does anyone know a quick solution to this please?

    Thanks for all your help,

    Gordon
     
    gordi555, Feb 29, 2008 IP
  2. AsHinE

    AsHinE Well-Known Member

    Messages:
    240
    Likes Received:
    8
    Best Answers:
    1
    Trophy Points:
    138
    #2
    Maybe i didn't understand the question properly, but you can put those discount codes in $_SESSION variable or in a cookie.
     
    AsHinE, Feb 29, 2008 IP
  3. gordi555

    gordi555 Active Member

    Messages:
    537
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    58
    #3
    Yes I'm storing discount in a session but I was wondering how can I easily re-post all the $_POST variables without to the page again?
     
    gordi555, Feb 29, 2008 IP
  4. bartolay13

    bartolay13 Active Member

    Messages:
    735
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    98
    #4
    you can store it into cookies,session, global and or to the db.

    or send it to the same page..

    <?php
    if(isset($_POST['yourform']))
    {
    echo "<form name="form2">";
    ...........
    echo "</form>";
    }

    <form name="yourform">
    ............
    </form>
    ?>
     
    bartolay13, Feb 29, 2008 IP
  5. AsHinE

    AsHinE Well-Known Member

    Messages:
    240
    Likes Received:
    8
    Best Answers:
    1
    Trophy Points:
    138
    #5
    If you need to repost variables I suggest to make them hidden fields on the form. <input type="hidden"> and so on.
     
    AsHinE, Feb 29, 2008 IP
  6. quicksolutions

    quicksolutions Peon

    Messages:
    17
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    As i understood your question: To get all posted data you can use foreach method like this


    foreach($_POST as $v){
    echo $v;
    }
     
    quicksolutions, Feb 29, 2008 IP