Home > Archive > PHP Programming > November 2006 > receive value $_POST
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
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 2006-11-28, 7:00 pm |
|
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.
| |
|
| 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@hotmail.com wrote:
> kirke wrote:
>
> you have to use square brackets.. $_POST["list"];
>
> Flamer.
| |
| Peter van Schie 2006-11-28, 7:00 pm |
| 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
| |
|
| 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($sql) or die();
while ($row = mssql_fetch_array($result))
{
$veh = $veh+","+$row[0]; }
But it doesn't work.....
Help me...
thx.
Peter van Schie wrote:
> kirke schreef:
>
> 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
| |
| Peter van Schie 2006-11-29, 7:00 pm |
| Hi kirke,
> $result= mssql_query($sql) or die();
>
> while ($row = mssql_fetch_array($result))
> {
> $veh = $veh+","+$row[0]; }
>
> But it doesn't work.....
> Help me...
> thx.
Just use mssql_fetch_assoc instead of mssql_fetch_array, 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($sql) or die();
while ($row = mssql_fetch_assoc($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_escape_string to escape the value, like:
mysql_real_escape_string($_POST['L'])
Peter.
--
http://www.phpforums.nl
| |
|
| Thx. it works.
However what i want to get is
$result=11,12,13
not $result=111213
How can I put comma between numbers?
Peter van Schie wrote:
> Hi kirke,
>
>
> Just use mssql_fetch_assoc instead of mssql_fetch_array, 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($sql) or die();
>
> while ($row = mssql_fetch_assoc($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_escape_string to escape the value, like:
> mysql_real_escape_string($_POST['L'])
>
> Peter.
>
> --
> http://www.phpforums.nl
| |
|
| Thx. it works.
However what i want to get is
$result=11,12,13
not $result=111213
How can I put comma between numbers?
Peter van Schie wrote:
> Hi kirke,
>
>
> Just use mssql_fetch_assoc instead of mssql_fetch_array, 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($sql) or die();
>
> while ($row = mssql_fetch_assoc($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_escape_string to escape the value, like:
> mysql_real_escape_string($_POST['L'])
>
> Peter.
>
> --
> http://www.phpforums.nl
| |
| Geoff Berrow 2006-11-30, 9:59 pm |
| Message-ID: <1164756533.089378.39630@j72g2000cwa.googlegroups.com> from
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/
|
|
|
|
|