receive value $_POST

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

    #1

    receive value $_POST

    hi, I wanna recevie from text box.
    there's a list of numbers in the text box named "list"(eg., 10, 12,
    23, 24,) like this.
    and then i try
    $L=$_POST("list ")
    but it doesn't work(i guess because of commas)
    is there any way to receive whole numbers with comma?
    Thx.

  • flamer die.spam@hotmail.com

    #2
    Re: receive value $_POST


    kirke wrote:
    hi, I wanna recevie from text box.
    there's a list of numbers in the text box named "list"(eg., 10, 12,
    23, 24,) like this.
    and then i try
    $L=$_POST("list ")
    but it doesn't work(i guess because of commas)
    is there any way to receive whole numbers with comma?
    Thx.
    you have to use square brackets.. $_POST["list"];

    Flamer.

    Comment

    • kirke

      #3
      Re: receive value $_POST

      oops, it was my mistake, I used square brackets. but still cannot
      receive whole list of numbers. Get only first number(before first
      comma)..

      flamer die.spam@hotmai l.com wrote:
      kirke wrote:
      hi, I wanna recevie from text box.
      there's a list of numbers in the text box named "list"(eg., 10, 12,
      23, 24,) like this.
      and then i try
      $L=$_POST("list ")
      but it doesn't work(i guess because of commas)
      is there any way to receive whole numbers with comma?
      Thx.
      >
      you have to use square brackets.. $_POST["list"];
      >
      Flamer.

      Comment

      • Peter van Schie

        #4
        Re: receive value $_POST

        kirke schreef:
        oops, it was my mistake, I used square brackets. but still cannot
        receive whole list of numbers. Get only first number(before first
        comma)..
        >
        Hi kirke,

        Maybe a stupid question, but how do you check the value of $L?
        You said you're using:

        $L=$_POST["list"];

        What's the output of:

        echo $L;

        Or just do something like:

        print_r($_POST) ;

        to check the contents of the $_POST array.

        Peter.

        --

        Comment

        • kirke

          #5
          Re: receive value $_POST

          Well, I just use the commend

          printf("%s ",%L);


          And, my question is changed! I find out $L=$_POST['list']; can get a
          list of numbers.

          And another problem is,
          Let's assume that $L=1,2,3
          There's a table such as

          A B
          11 1
          12 2
          13 3
          14 4
          15 5
          16 6

          Then,

          $sql="select A
          FROM TABLE
          WHERE B in ($L)
          ";

          can be used. After that, How can I save 11,12,13 for one variable?
          my thought was,

          $result= mssql_query($sq l) or die();

          while ($row = mssql_fetch_arr ay($result))
          {
          $veh = $veh+","+$row[0]; }

          But it doesn't work.....
          Help me...
          thx.



          Peter van Schie wrote:
          kirke schreef:
          oops, it was my mistake, I used square brackets. but still cannot
          receive whole list of numbers. Get only first number(before first
          comma)..
          >
          Hi kirke,
          >
          Maybe a stupid question, but how do you check the value of $L?
          You said you're using:
          >
          $L=$_POST["list"];
          >
          What's the output of:
          >
          echo $L;
          >
          Or just do something like:
          >
          print_r($_POST) ;
          >
          to check the contents of the $_POST array.
          >
          Peter.
          >
          --
          http://www.phpforums.nl

          Comment

          • Peter van Schie

            #6
            Re: receive value $_POST

            Hi kirke,
            $result= mssql_query($sq l) or die();
            >
            while ($row = mssql_fetch_arr ay($result))
            {
            $veh = $veh+","+$row[0]; }
            >
            But it doesn't work.....
            Help me...
            thx.
            Just use mssql_fetch_ass oc instead of mssql_fetch_arr ay, to only
            retrieve the associative array.
            Then you can use $row['A'] for instance to show the value of the current
            row's A value:

            $result= mssql_query($sq l) or die();

            while ($row = mssql_fetch_ass oc($result))
            {
            echo $row['A'] . '<br />';
            }

            Also note that you should check the input value of the formfield L,
            instead of just using it in the sql query. You should use
            mysql_real_esca pe_string to escape the value, like:
            mysql_real_esca pe_string($_POS T['L'])

            Peter.

            --

            Comment

            • kirke

              #7
              Re: receive value $_POST

              Thx. it works.
              However what i want to get is
              $result=11,12,1 3
              not $result=111213
              How can I put comma between numbers?



              Peter van Schie wrote:
              Hi kirke,
              >
              $result= mssql_query($sq l) or die();

              while ($row = mssql_fetch_arr ay($result))
              {
              $veh = $veh+","+$row[0]; }

              But it doesn't work.....
              Help me...
              thx.
              >
              Just use mssql_fetch_ass oc instead of mssql_fetch_arr ay, to only
              retrieve the associative array.
              Then you can use $row['A'] for instance to show the value of the current
              row's A value:
              >
              $result= mssql_query($sq l) or die();
              >
              while ($row = mssql_fetch_ass oc($result))
              {
              echo $row['A'] . '<br />';
              }
              >
              Also note that you should check the input value of the formfield L,
              instead of just using it in the sql query. You should use
              mysql_real_esca pe_string to escape the value, like:
              mysql_real_esca pe_string($_POS T['L'])
              >
              Peter.
              >
              --
              http://www.phpforums.nl

              Comment

              • kirke

                #8
                Re: receive value $_POST

                Thx. it works.
                However what i want to get is
                $result=11,12,1 3
                not $result=111213
                How can I put comma between numbers?



                Peter van Schie wrote:
                Hi kirke,
                >
                $result= mssql_query($sq l) or die();

                while ($row = mssql_fetch_arr ay($result))
                {
                $veh = $veh+","+$row[0]; }

                But it doesn't work.....
                Help me...
                thx.
                >
                Just use mssql_fetch_ass oc instead of mssql_fetch_arr ay, to only
                retrieve the associative array.
                Then you can use $row['A'] for instance to show the value of the current
                row's A value:
                >
                $result= mssql_query($sq l) or die();
                >
                while ($row = mssql_fetch_ass oc($result))
                {
                echo $row['A'] . '<br />';
                }
                >
                Also note that you should check the input value of the formfield L,
                instead of just using it in the sql query. You should use
                mysql_real_esca pe_string to escape the value, like:
                mysql_real_esca pe_string($_POS T['L'])
                >
                Peter.
                >
                --
                http://www.phpforums.nl

                Comment

                • Geoff Berrow

                  #9
                  Re: receive value $_POST

                  Message-ID: <1164756533.089 378.39630@j72g2 000cwa.googlegr oups.comfrom
                  kirke contained the following:
                  $veh = $veh+","+$row[0];
                  $veh = $veh.",".$row[0];

                  --
                  Geoff Berrow (put thecat out to email)
                  It's only Usenet, no one dies.
                  My opinions, not the committee's, mine.
                  Simple RFDs http://www.ckdog.co.uk/rfdmaker/

                  Comment

                  • kirke

                    #10
                    Re: receive value $_POST

                    wow, it's so simple! Thx a lot.

                    Geoff Berrow wrote:
                    Message-ID: <1164756533.089 378.39630@j72g2 000cwa.googlegr oups.comfrom
                    kirke contained the following:
                    >
                    $veh = $veh+","+$row[0];
                    >
                    $veh = $veh.",".$row[0];
                    >
                    --
                    Geoff Berrow (put thecat out to email)
                    It's only Usenet, no one dies.
                    My opinions, not the committee's, mine.
                    Simple RFDs http://www.ckdog.co.uk/rfdmaker/

                    Comment

                    • Geoff Berrow

                      #11
                      Re: receive value $_POST

                      Message-ID: <1165011575.467 802.155970@j72g 2000cwa.googleg roups.comfrom
                      kirke contained the following:
                      >Geoff Berrow wrote:
                      > $veh = $veh.",".$row[0];
                      >wow, it's so simple! Thx a lot.
                      Yeah, the + sign is the concatenation operator in Javascript.

                      Please don't top post. :-)
                      --
                      Geoff Berrow (put thecat out to email)
                      It's only Usenet, no one dies.
                      My opinions, not the committee's, mine.
                      Simple RFDs http://www.ckdog.co.uk/rfdmaker/

                      Comment

                      Working...