Passing data between php files

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • cover

    Passing data between php files

    I have a form with two drop down boxes that are hard coded as in the
    example below, and another drop down (pull down) box that is populated
    as a result of a MySQL query. All appears to work as it should with
    the exception that after choices have been made and the submit button
    clicked, (to either enter the data into another database OR work
    together in another query - I've tried both), the field that was
    populated by the initial query does not pass it's data as the hard
    coded fields do. In other words, the 'month' below passes user data
    to $month in mmonth.php but the data in the queried cell 'person' does
    not pass to $person in mmonth.php - can anyone tell me why is
    that? TIA - appreciate all replies...


    <form method="post" action="mmonth. php">
    <input type="hidden" name="id" value="NULL">
    <tr>
    <td><b>Month: </b></td>
    <td><select name="month">
    <option value = "Jan">Jan</option>
    <option value = "Feb">Feb</option>
    <option value = "Mar">Mar</option>
    <option value = "Apr">Apr</option>
    <option value = "May">May</option> etc
    </select>
    </td>
    </tr>
  • Jerry Stuckle

    #2
    Re: Passing data between php files

    cover wrote:[color=blue]
    > I have a form with two drop down boxes that are hard coded as in the
    > example below, and another drop down (pull down) box that is populated
    > as a result of a MySQL query. All appears to work as it should with
    > the exception that after choices have been made and the submit button
    > clicked, (to either enter the data into another database OR work
    > together in another query - I've tried both), the field that was
    > populated by the initial query does not pass it's data as the hard
    > coded fields do. In other words, the 'month' below passes user data
    > to $month in mmonth.php but the data in the queried cell 'person' does
    > not pass to $person in mmonth.php - can anyone tell me why is
    > that? TIA - appreciate all replies...
    >
    >
    > <form method="post" action="mmonth. php">
    > <input type="hidden" name="id" value="NULL">
    > <tr>
    > <td><b>Month: </b></td>
    > <td><select name="month">
    > <option value = "Jan">Jan</option>
    > <option value = "Feb">Feb</option>
    > <option value = "Mar">Mar</option>
    > <option value = "Apr">Apr</option>
    > <option value = "May">May</option> etc
    > </select>
    > </td>
    > </tr>[/color]

    They only way the select box would pass the value to $month in
    mmonth.php would be if register_global s were set to "on" - which is a
    huge security hole.

    Rather, you should have register_global s set to "off" (which it probably
    is since you don't see the value passed) and you can find the value in
    $_POST['month'].

    And next time you might try posting to ONE or TWO newsgroups.


    --
    =============== ===
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    jstucklex@attgl obal.net
    =============== ===

    Comment

    • cover

      #3
      Re: Passing data between php files

      On Sun, 09 Oct 2005 17:09:17 -0500, Jerry Stuckle
      <jstucklex@attg lobal.net> wrote:
      [color=blue]
      >They only way the select box would pass the value to $month in
      >mmonth.php would be if register_global s were set to "on" - which is a
      >huge security hole.
      >
      >Rather, you should have register_global s set to "off" (which it probably
      >is since you don't see the value passed) and you can find the value in
      >$_POST['month'].[/color]

      Thanks, using $_POST['month'] and $_POST['person'], does indeed pass
      the values for 'month', just not 'person'. It reads 'person' just
      fine to populate the first query but wont pass the newly populated
      drop down value anywhere else in spite of using $_POST['person'] on
      that page. There must be some way to retain the value of 'person' and
      pass it as much as you like between pages.


      Comment

      • Oli Filth

        #4
        Re: Passing data between php files

        cover said the following on 11/10/2005 10:15:[color=blue]
        > On Sun, 09 Oct 2005 17:09:17 -0500, Jerry Stuckle
        > <jstucklex@attg lobal.net> wrote:
        >
        >[color=green]
        >>They only way the select box would pass the value to $month in
        >>mmonth.php would be if register_global s were set to "on" - which is a
        >>huge security hole.
        >>
        >>Rather, you should have register_global s set to "off" (which it probably
        >>is since you don't see the value passed) and you can find the value in
        >>$_POST['month'].[/color]
        >
        >
        > Thanks, using $_POST['month'] and $_POST['person'], does indeed pass
        > the values for 'month', just not 'person'. It reads 'person' just
        > fine to populate the first query but wont pass the newly populated
        > drop down value anywhere else in spite of using $_POST['person'] on
        > that page. There must be some way to retain the value of 'person' and
        > pass it as much as you like between pages.
        >[/color]

        The fact that the HTML for the "person" choice was originally
        dynamically generated will have *no* bearing on whether GET/POST
        variables are being recieved, unless it was dynamically generating
        *incorrect* HTML.

        Check the HTML source in your browser, and make sure the generated code
        is correct.


        Note: F'up to alt.php.sql removed.


        --
        Oli

        Comment

        • Jerry Stuckle

          #5
          Re: Passing data between php files

          cover wrote:
          [color=blue]
          >
          > Thanks, using $_POST['month'] and $_POST['person'], does indeed pass
          > the values for 'month', just not 'person'. It reads 'person' just
          > fine to populate the first query but wont pass the newly populated
          > drop down value anywhere else in spite of using $_POST['person'] on
          > that page. There must be some way to retain the value of 'person' and
          > pass it as much as you like between pages.
          >
          >[/color]

          OK, but since you didn't post the failing code, it's impossible to tell
          what's going on.

          Try posting the entire contents of your form.

          --
          =============== ===
          Remove the "x" from my email address
          Jerry Stuckle
          JDS Computer Training Corp.
          jstucklex@attgl obal.net
          =============== ===

          Comment

          Working...