passing variables between forms

Discussion in 'PHP' started by kharearch, Dec 12, 2007.

  1. #1
    In my application there are 3 files. My files are linked in following way.

    shop.htm-> order.php ->query.php

    I want to use shop.htm variables and text boxes values in query.php file. Which is not directly linked with shop.htm file. How can I pass variables and control value to query.php file. Please help me.
     
    kharearch, Dec 12, 2007 IP
  2. Gawk

    Gawk Peon

    Messages:
    427
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If you change shop.htm to shop.php you can use sessions to pass values around easily.
     
    Gawk, Dec 12, 2007 IP
  3. kmap

    kmap Well-Known Member

    Messages:
    2,215
    Likes Received:
    29
    Best Answers:
    2
    Trophy Points:
    135
    #3
    You can use Session variables in order.php if number of variables are less

    Best way is use hidden text field in order.php inside a form(if it has a form)

    <input type="hidden" name="n1" value=$_POST["first variable"]>

    I hope this helps

    Regards

    Alex
     
    kmap, Dec 12, 2007 IP
  4. itsme

    itsme Well-Known Member

    Messages:
    1,232
    Likes Received:
    96
    Best Answers:
    0
    Trophy Points:
    180
    #4
    you can also use cookies
     
    itsme, Dec 12, 2007 IP
  5. coderbari

    coderbari Well-Known Member

    Messages:
    3,168
    Likes Received:
    193
    Best Answers:
    0
    Trophy Points:
    135
    #5
    If there is a form in order.php then u can follow kmap :
    <input type="hidden" name="n1" value="<?php echo $_POST["first variable"]; ?>">
    use this inside the form and u will get it as $_POST["n1"] in query.php.

    But if order.php doesn't have any form then u have to use session or cookie and in that case shop.htm has to be shop.php.
     
    coderbari, Dec 12, 2007 IP
  6. kmap

    kmap Well-Known Member

    Messages:
    2,215
    Likes Received:
    29
    Best Answers:
    2
    Trophy Points:
    135
    #6
    no need to change shop.htm to shop.php

    as shop.htm only contains a form

    Use session in order.php
    Regards

    Alex
     
    kmap, Dec 12, 2007 IP
  7. ven123

    ven123 Banned

    Messages:
    389
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #7
    I would either store values in session, cookies or just pass the variable using post.
     
    ven123, Dec 12, 2007 IP