473,378 Members | 1,594 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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.

Nov 28 '06 #1
10 2077

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.

Nov 28 '06 #2
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 di******@hotmail.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.
Nov 28 '06 #3
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
Nov 28 '06 #4
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:
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
Nov 28 '06 #5
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
Nov 29 '06 #6
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,
$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
Nov 30 '06 #7
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,
$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
Nov 30 '06 #8
Message-ID: <11*********************@j72g2000cwa.googlegroups. 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/
Dec 1 '06 #9
wow, it's so simple! Thx a lot.

Geoff Berrow wrote:
Message-ID: <11*********************@j72g2000cwa.googlegroups. 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/
Dec 1 '06 #10
Message-ID: <11**********************@j72g2000cwa.googlegroups .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/
Dec 1 '06 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: toedipper | last post by:
Hello, windows xp, apache, php and my sql and dreamweaver mx I have the code below. And it does'nt work! Basically the code below is the workings behind the scene that inserts a record to a...
0
by: tania | last post by:
i have this table in my database: CREATE TABLE FILM( F_ID INT(5) NOT NULL AUTO_INCREMENT, F_TITLE VARCHAR(40) NOT NULL, DIRECTOR_FNAME VARCHAR(20) NOT NULL, DIRECTOR_LNAME VARCHAR(20) NOT NULL,...
3
cassbiz
by: cassbiz | last post by:
Here is what I want to do, if possible. I have a reservation form, where one value (credit card number) needs to be run through an encryption script then get posted to the DB where all of the...
2
by: php_Boi | last post by:
i have designed an application that is a dynamic submission form. i have text fields and listboxes. now i am able to retain the values of the listboxes when i populate the listbox "manually"(single...
2
by: semi_evil | last post by:
Hi, I have recently taken up PHP programming, and I got stuck on the following. <? $p_body = (isset ($_POST) && ($_POST != '')) ? $_POST : 'Enter your text here'; $p_name = (isset ($_POST) &&...
1
by: kang jia | last post by:
hi currently i am editing signup page, when user enter deupicated NRIC and click signup, they will go to do_signuppage and read the error message and then after 5 seconds, they will be redirected...
4
chumlyumly
by: chumlyumly | last post by:
Hi - I'm working with PHP5 MySQL Mac OSX I've developed two pages where a user can input his/her info, which goes to a MySQL database. The first page is supposed to pass the newly created...
2
by: mstng07 | last post by:
How can i get a return value of 1 if the user exists in the table instead of it returning a -1? <?php require("config.php"); if($_GET == 'post') { if(empty($_POST) || empty($_POST) ||...
2
by: permander kumar | last post by:
hi plz help me, i have a code in which two multiple selection dropdown list. in first list if I am select single value the data are fetch in second table on button click. but the problem is in...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.