-
From: ioannes [mailto:[EMAIL PROTECTED]
Sent: Friday, 29 August 2008 1:22 PM
To: php-general@lists.php.net
Subject: Re: [PHP] Re: Variable name as a string
In writing the script, though, there are two points. I don't always use
checkboxes, sometimes I just want to update all the records
On 28 August 2008 04:26, Micah Gersten advised:
You cannot have anything in the brackets for the name in a checkbox
group. The brackets specify that it is an array. The name
of the array
is the key in $_POST that contains the values of the checkbox group
that
were checked. You can have as
On 28 August 2008 00:04, tedd advised:
At 12:07 AM +0200 8/28/08, Maciek Sokolewicz wrote:
input type=check name=my_checkboxes[1] value=1 / 1br /
input type=check name=my_checkboxes[2] value=1 / 1br /
input type=check name=my_checkboxes[3] value=1 / 1br /
input type=check
At 11:50 AM +0100 8/28/08, Ford, Mike wrote:
On 28 August 2008 00:04, tedd advised:
One of the ways to get around this is to:
input type=checkbox name=my_checkboxes[]
id=my_checkbox_1 value=1
That way php will use name and javascript will use id.
Why???
form name=my_form ...
, one
the parameter - so it makes sense (sort of) to use two different terms.
Simcha Younger
-Original Message-
From: tedd [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 28, 2008 4:40 PM
To: php-general@lists.php.net
Subject: RE: [PHP] Re: Variable name as a string
At 11:50 AM +0100 8
In writing the script, though, there are two points. I don't always use
checkboxes, sometimes I just want to update all the records on the
form. Eg I have a series of images and related text each with their ID
in the database table, on clicking update all the form elements get
submitted and
ioannes wrote:
Could someone tell me how to get the name of a variable as a string.
This would be useful in form submission with multiple check-boxes to
match against database records. At the moment I use ${var.$ID[$x]} or
someting like that to go through all the possible matches, but it
Perhaps this example may help. Eg: a form with checkboxes and submit
button, a few are checked and I want to delete the corresponding records
from the database. The database table has an ID column:
for each ($argv as $key=$value) {
//$key is named cb_1 $value is checked
//to get 1 from
At 4:55 PM +0100 8/27/08, JOHN DILLON wrote:
Perhaps this example may help. Eg: a form with checkboxes and
submit button, a few are checked and I want to delete the
corresponding records from the database. The database table has an
ID column:
for each ($argv as $key=$value) {
//$key is
Yes, Tedd, this does however incur the overhead of find out what i is,
because it could be a range of IDs from the database, not necessarily a
count of the checkboxes on the page:
for ($i = 1; $i = 4; $i++)
{
$a = 'a' . $i;
$b = 'whatever' . $i;
if($_POST[$a] == 'on')
{
At 7:08 PM +0100 8/27/08, ioannes wrote:
Yes, Tedd, this does however incur the overhead of find out what i
is, because it could be a range of IDs from the database, not
necessarily a count of the checkboxes on the page:
for ($i = 1; $i = 4; $i++)
{
$a = 'a' . $i;
$b = 'whatever' .
Actually, you are right, as you just put the checkbox index in the POST
and get the value from there. So you just need the number of
checkboxes...sorry.
ioannes wrote:
Yes, Tedd, this does however incur the overhead of find out what i is,
because it could be a range of IDs from the database,
ioannes wrote:
Actually, you are right, as you just put the checkbox index in the POST
and get the value from there. So you just need the number of
checkboxes...sorry.
ioannes wrote:
Yes, Tedd, this does however incur the overhead of find out what i is,
because it could be a range of IDs
At 1:58 PM -0500 8/27/08, Shawn McKenzie wrote:
ioannes wrote:
Actually, you are right, as you just put the checkbox index in the
POST and get the value from there. So you just need the number of
checkboxes...sorry.
for ($i = 1; $i = 4; $i++)
{
$a = 'a' . $i;
$b = 'whatever' . $i;
tedd wrote:
At 1:58 PM -0500 8/27/08, Shawn McKenzie wrote:
ioannes wrote:
Actually, you are right, as you just put the checkbox index in the
POST and get the value from there. So you just need the number of
checkboxes...sorry.
for ($i = 1; $i = 4; $i++)
{
$a = 'a' . $i;
$b =
First, the type is checkbox, not check. Second, you cannot put a value
in the brackets for a checkbox group. A checkbox group is passed to
PHP automatically as an array.
Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com
Maciek Sokolewicz wrote:
Well, this
At 12:07 AM +0200 8/28/08, Maciek Sokolewicz wrote:
tedd wrote:
At 1:58 PM -0500 8/27/08, Shawn McKenzie wrote:
ioannes wrote:
Actually, you are right, as you just put the checkbox index in
the POST and get the value from there. So you just need the
number of checkboxes...sorry.
for ($i =
tedd wrote:
At 1:58 PM -0500 8/27/08, Shawn McKenzie wrote:
ioannes wrote:
Actually, you are right, as you just put the checkbox index in the
POST and get the value from there. So you just need the number of
checkboxes...sorry.
for ($i = 1; $i = 4; $i++)
{
$a = 'a' . $i;
$b =
You cannot have anything in the brackets for the name in a checkbox
group. The brackets specify that it is an array. The name of the array
is the key in $_POST that contains the values of the checkbox group that
were checked. You can have as many groups as you like.
Thank you,
Micah Gersten
Micah Gersten wrote:
You cannot have anything in the brackets for the name in a checkbox
group. The brackets specify that it is an array. The name of the array
is the key in $_POST that contains the values of the checkbox group that
were checked. You can have as many groups as you like.
Eh?
On Wed, 27 Aug 2008 22:25:44 -0500, Micah Gersten wrote:
You cannot have anything in the brackets for the name in a checkbox
group. [...]
Bollocks.
form action=?php echo $_SERVER['SCRIPT_NAME']; ? method=post
poption 1 - colour: input type=text name=options[colour]//p
poption 2 - flavour:
More specifically:
form action=?php echo $_SERVER['SCRIPT_NAME']; ? method=post
poption 1 - colour:br/
# input type=checkbox name=options[colour][] value=red/ redbr/
# input type=checkbox name=options[colour][] value=green/
greenbr/
# input type=checkbox name=options[colour][] value=blue/
blue/p
22 matches
Mail list logo