Can i use post and get together?

Discussion in 'PHP' started by baris22, Feb 13, 2010.

  1. #1
    hello,

    if i do this way will it cause any problem?

    
    
    if (isset($_POST['order_ready'])) 
    {
    $id = $_GET['id'];
    $ref = $_GET['ref'];
    $orderr_ready = $_GET['orderready'];
    
    }
    <form name="order_ready" action="<?=$PHP_SELF;?>?id=<?=$orderr_id;?>&ref=<?=$orderr_reference;?>&orderready=No" method="post">
        <input type="submit" name="order_ready" value="Mark as Order NOT READY" style="width: 340px; height:40px" />
    </form>
    
    
    PHP:
     
    baris22, Feb 13, 2010 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,792
    Likes Received:
    4,529
    Best Answers:
    123
    Trophy Points:
    665
    #2
    You can because the form can be submitted to /myscript.php?id=123

    However this isn't the norm.

    If you have any queries about what is being passed just do a var_dump() on $_POST and $_GET
     
    sarahk, Feb 13, 2010 IP
  3. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #3
    Well the way u want it it could be possible but as a form its tough to use both
     
    Bohra, Feb 13, 2010 IP
  4. sarahk

    sarahk iTamer Staff

    Messages:
    28,792
    Likes Received:
    4,529
    Best Answers:
    123
    Trophy Points:
    665
    #4
    Quite right, the actual inputs to the form have to be one or the other

    Remember to use &amp; as well!
     
    sarahk, Feb 13, 2010 IP
  5. nadiralishah_webexpert

    nadiralishah_webexpert Guest

    Messages:
    229
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    for sure you can use both. should work perfectly.. i do use both sometimes.. and it works for me.
     
    nadiralishah_webexpert, Feb 14, 2010 IP