RE: [PHP] Re: Variable name as a string

2008-08-29 Thread Bren Norris
ssage- 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 reco

Re: [PHP] Re: Variable name as a string

2008-08-28 Thread ioannes
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 I

RE: [PHP] Re: Variable name as a string

2008-08-28 Thread Simcha
, 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

RE: [PHP] Re: Variable name as a string

2008-08-28 Thread tedd
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: > That way php will use "name" and javascript will use "id". Why??? checkboxes = document.my_form["my_checkboxes[]"]; Cheers! Mike

RE: [PHP] Re: Variable name as a string

2008-08-28 Thread Ford, Mike
On 28 August 2008 00:04, tedd advised: > At 12:07 AM +0200 8/28/08, Maciek Sokolewicz wrote: >> 1 >> 1 >> 1 >> 1 >> >> $my_checked_checkboxes = $_REQUEST['my_checkboxes']; // whichever >> you wish, $_GET or $_POST, I don't care right now; you choose. > > Yeah, I remember that -- but a bit d

RE: [PHP] Re: Variable name as a string

2008-08-28 Thread Ford, Mike
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 hav

Re: [PHP] Re: Variable name as a string

2008-08-27 Thread Ross McKay
More specifically: option 1 - colour: # red # green # blue colour: $colour\n"; ?> -- Ross McKay, Toronto, NSW Australia "If ye cannae see the bottom, dinnae complain if ye droon" - The Wee Book of Calvin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.

Re: [PHP] Re: Variable name as a string

2008-08-27 Thread Ross McKay
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. option 1 - colour: option 2 - flavour: option 3 - size: colour: $colour\n"; $flavour = $_POST['options']['flavour']; echo

Re: [PHP] Re: Variable name as a string

2008-08-27 Thread Chris
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?

Re: [PHP] Re: Variable name as a string

2008-08-27 Thread Micah Gersten
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 onS

Re: [PHP] Re: Variable name as a string

2008-08-27 Thread Shawn McKenzie
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 = 'wha

Re: [PHP] Re: Variable name as a string

2008-08-27 Thread tedd
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 =

Re: [PHP] Re: Variable name as a string

2008-08-27 Thread Micah Gersten
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

Re: [PHP] Re: Variable name as a string

2008-08-27 Thread Maciek Sokolewicz
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 = 'wha

Re: [PHP] Re: Variable name as a string

2008-08-27 Thread tedd
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;

Re: [PHP] Re: Variable name as a string

2008-08-27 Thread Shawn McKenzie
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 fro

Re: [PHP] Re: Variable name as a string

2008-08-27 Thread ioannes
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,

Re: [PHP] Re: Variable name as a string

2008-08-27 Thread tedd
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' .

Re: [PHP] Re: Variable name as a string

2008-08-27 Thread ioannes
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') {

Re: [PHP] Re: Variable name as a string

2008-08-27 Thread tedd
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

Re: [PHP] Re: Variable name as a string

2008-08-27 Thread JOHN DILLON
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 fr