Passing variables from page to page

Discussion in 'PHP' started by ausgezeichnete, Dec 7, 2007.

  1. #1
    I made this form in the "index page"
    and when i did : echo $ days it in the "search_results.php" page ,it was ok

    Now i have made another form in the "search_results.php"
    and in the "continute.php"
    i calculated the sum of the checkboxes selection
    but my problem now is:
    i want to compare between the $days in the "index.php " and the $sum of the checkboxs selection
    but each time i try to echo $days in the "contniue.php" it deosnt seem to see it
    why???

     
    ausgezeichnete, Dec 7, 2007 IP
  2. selling vcc

    selling vcc Peon

    Messages:
    361
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Let me tell you first that you need to read a good tutorial about passing variables with php, I don't wanna scare you now.

    well... try this

    echo "<form action='calculate.php' method='post'>";
    while($record=mysqli_fetch_assoc($result)){
    $days_db=$record['days'];
    echo "<input type='checkbox' name='choose[]' value='{$days_db}' />";
    echo "<input type='hidden' name='days' value='$days' />";
    echo "<input type='submit' name='submit' value='Continue'>";
    echo "</form>";
    PHP:
     
    selling vcc, Dec 7, 2007 IP
  3. ausgezeichnete

    ausgezeichnete Peon

    Messages:
    54
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thnxxxx it worked
     
    ausgezeichnete, Dec 7, 2007 IP
  4. ausgezeichnete

    ausgezeichnete Peon

    Messages:
    54
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    but please i have another problem in mysql query
    my select is
    i have records conatins :5,10,15 days
    every time i choose +/-7 days which has the values 7
    it gives me 0
    and when i select +/14 which has the value 14
    its gives me the days 5,15
    and when i select +/-21
    its gives me the days 5
    why????????
    i think mysql query contains something wrong ???
     
    ausgezeichnete, Dec 7, 2007 IP
  5. sm9ai

    sm9ai Active Member

    Messages:
    746
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    60
    #5
    Is the days field in your database set to an Int?
     
    sm9ai, Dec 7, 2007 IP
  6. ausgezeichnete

    ausgezeichnete Peon

    Messages:
    54
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Ok tthnxxxx
    i was putting it as varchar in my database and when i changed it to int
    it worked just fine
    thnxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
     
    ausgezeichnete, Dec 7, 2007 IP