Post variables after java sort are lost

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

    Post variables after java sort are lost

    Hello,

    I have an HTML table that is being constructed from a MySQL table and
    displays a form that includes a check box on 1 of the fields on the form for
    each record. I have included in this PHP program a javascript routine called
    sorttable.js which is something I found on the internet for sorting tables
    and works quite well. The HTML table includes a check box on each record so
    the user can select certain records for passing to the next process. This
    works fine unless I sort the table on some column and then the POST
    variables are lost. When I run the following code there are no POST
    variables that will echo except the submit button.

    foreach ($_POST as $varName =$value){
    echo ($varName . " = " . $value);
    }

    However, if I don't sort the table the POST variables will be echoed for
    every record in the table. I'm not sure why this is happening or how to go
    about solving it. When I check certain records on the form and then sort the
    table the checks themself don't disappear only the POST variables do. This
    prevents me from looping thru the ARRAY to determine the value of the POST
    check box for each record to see if it was checked. If I run the above code
    but don't sort it I will have several hundred POST variables (several for
    each record).

    Could someone give me an idea on how to solve this or offer some sort of
    work-around??

    Thanks Very Much!

    Vic


  • Jerry Stuckle

    #2
    Re: Post variables after java sort are lost

    Vic Spainhower wrote:
    Hello,
    >
    I have an HTML table that is being constructed from a MySQL table and
    displays a form that includes a check box on 1 of the fields on the form for
    each record. I have included in this PHP program a javascript routine called
    sorttable.js which is something I found on the internet for sorting tables
    and works quite well. The HTML table includes a check box on each record so
    the user can select certain records for passing to the next process. This
    works fine unless I sort the table on some column and then the POST
    variables are lost. When I run the following code there are no POST
    variables that will echo except the submit button.
    >
    foreach ($_POST as $varName =$value){
    echo ($varName . " = " . $value);
    }
    >
    However, if I don't sort the table the POST variables will be echoed for
    every record in the table. I'm not sure why this is happening or how to go
    about solving it. When I check certain records on the form and then sort the
    table the checks themself don't disappear only the POST variables do. This
    prevents me from looping thru the ARRAY to determine the value of the POST
    check box for each record to see if it was checked. If I run the above code
    but don't sort it I will have several hundred POST variables (several for
    each record).
    >
    Could someone give me an idea on how to solve this or offer some sort of
    work-around??
    >
    Thanks Very Much!
    >
    Vic
    >
    >
    Maybe fix your javascript code? This isn't a PHP problem.

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

    Comment

    • Vic Spainhower

      #3
      Re: Post variables after java sort are lost

      >Maybe fix your javascript code? This isn't a PHP problem.

      I know it's not a PHP problem and I don't know javascript or I would fix it.
      I was hoping someone could offer a work-around as how to sort tables with
      PHP on the fly.

      Vic


      "Jerry Stuckle" <jstucklex@attg lobal.netwrote in message
      news:4dmdnQRT1J G5X2XYnZ2dnUVZ_ ozinZ2d@comcast .com...
      Vic Spainhower wrote:
      >Hello,
      >>
      >I have an HTML table that is being constructed from a MySQL table and
      >displays a form that includes a check box on 1 of the fields on the form
      >for each record. I have included in this PHP program a javascript routine
      >called sorttable.js which is something I found on the internet for
      >sorting tables and works quite well. The HTML table includes a check box
      >on each record so the user can select certain records for passing to the
      >next process. This works fine unless I sort the table on some column and
      >then the POST variables are lost. When I run the following code there are
      >no POST variables that will echo except the submit button.
      >>
      > foreach ($_POST as $varName =$value){
      > echo ($varName . " = " . $value);
      > }
      >>
      >However, if I don't sort the table the POST variables will be echoed for
      >every record in the table. I'm not sure why this is happening or how to
      >go about solving it. When I check certain records on the form and then
      >sort the table the checks themself don't disappear only the POST
      >variables do. This prevents me from looping thru the ARRAY to determine
      >the value of the POST check box for each record to see if it was checked.
      >If I run the above code but don't sort it I will have several hundred
      >POST variables (several for each record).
      >>
      >Could someone give me an idea on how to solve this or offer some sort of
      >work-around??
      >>
      >Thanks Very Much!
      >>
      >Vic
      >>
      >>
      >
      Maybe fix your javascript code? This isn't a PHP problem.
      >
      --
      =============== ===
      Remove the "x" from my email address
      Jerry Stuckle
      JDS Computer Training Corp.
      jstucklex@attgl obal.net
      =============== ===

      Comment

      • Jerry Stuckle

        #4
        Re: Post variables after java sort are lost

        Vic Spainhower wrote:
        "Jerry Stuckle" <jstucklex@attg lobal.netwrote in message
        news:4dmdnQRT1J G5X2XYnZ2dnUVZ_ ozinZ2d@comcast .com...
        >Vic Spainhower wrote:
        >>Hello,
        >>>
        >>I have an HTML table that is being constructed from a MySQL table and
        >>displays a form that includes a check box on 1 of the fields on the form
        >>for each record. I have included in this PHP program a javascript routine
        >>called sorttable.js which is something I found on the internet for
        >>sorting tables and works quite well. The HTML table includes a check box
        >>on each record so the user can select certain records for passing to the
        >>next process. This works fine unless I sort the table on some column and
        >>then the POST variables are lost. When I run the following code there are
        >>no POST variables that will echo except the submit button.
        >>>
        >> foreach ($_POST as $varName =$value){
        >> echo ($varName . " = " . $value);
        >> }
        >>>
        >>However, if I don't sort the table the POST variables will be echoed for
        >>every record in the table. I'm not sure why this is happening or how to
        >>go about solving it. When I check certain records on the form and then
        >>sort the table the checks themself don't disappear only the POST
        >>variables do. This prevents me from looping thru the ARRAY to determine
        >>the value of the POST check box for each record to see if it was checked.
        >>If I run the above code but don't sort it I will have several hundred
        >>POST variables (several for each record).
        >>>
        >>Could someone give me an idea on how to solve this or offer some sort of
        >>work-around??
        >>>
        >>Thanks Very Much!
        >>>
        >>Vic
        >>>
        >>>
        >Maybe fix your javascript code? This isn't a PHP problem.
        >>
        >--
        >============== ====
        >Remove the "x" from my email address
        >Jerry Stuckle
        >JDS Computer Training Corp.
        >jstucklex@attgl obal.net
        >============== ====
        >
        >
        >>Maybe fix your javascript code? This isn't a PHP problem.
        >
        I know it's not a PHP problem and I don't know javascript or I would
        fix it.
        I was hoping someone could offer a work-around as how to sort tables
        with
        PHP on the fly.
        >
        Vic
        >
        >
        (Top posting fixed)

        PHP is server-side. It can't sort client-side. To sort with PHP you
        would have to call the server, get the data again (this time sorted) and
        redisplay the page. Not hard, but some extra overhead compared to the
        Javascript.

        P.S. Please don't top post.

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

        Comment

        Working...