RE: HTML Forms question...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



	Javascript...  What's that???

	Just kidding.  I know what it is, but that is about the extent of my
knowledge.  Thanks for all the great feedback.  I was actually just looking
to be pointed in the right direction as this was a bit outside the scope of
this group.  You guys come through in shining fashion though and solve the
problem for me.

	Now just to figure out the next 73 issues/steps/challenges/problems.
:)

-----Original Message-----
From: Ryan Jameson (USA) [mailto:RJameson@usa.ibs.org]
Sent: Tuesday, November 19, 2002 11:44 AM
To: php-db@lists.php.net
Subject: RE:  HTML Forms question...


You learn something new every day! I'll have to remember the [] thing.
My way of handling this situation that does not screw up JavaScript is to
assign the names sequentially, so instead of all the checkboxes being system
they would be system0,system1,... Since PHP is so wonderfully easy to use
for referencing variable variable names I simply loop through:

for($i=0;$i<NUMBEROFCHECKBOXES;$i++){
  $var = "system$i";
  $val = $$var;
  if (isset($$var)) //<--- I think this works.
    echo "$var = $val<br>";
  else
    echo "$var is not checked.";
}

Since I always end up creating the form in PHP I just have the algorithm put
a hidden field in the form that contains the number of checkboxes, in fact
my PHP usually creates the JavaScript code as well, so it ends up being
pretty flexible.

<>< Ryan


-----Original Message-----
From: Rich Gray [mailto:rich@f1central.net]
Sent: Tuesday, November 19, 2002 6:13 PM
To: NIPP, SCOTT V (SBCSI); php-db@lists.php.net
Subject: RE:  HTML Forms question...


If you name the checkbox as name="system[]" then PHP will automatically
create an array of the checkbox values which can be subsequently accessed
via $_POST['system'][n] - be warned however that the '[]' can screw up any
JavaScript code that refers to the checkbox object...

HTH
Rich
-----Original Message-----
From: NIPP, SCOTT V (SBCSI) [mailto:sn4265@sbc.com]
Sent: 19 November 2002 08:53
To: 'Ryan Jameson (USA)'; php-db@lists.php.net
Subject: RE:  HTML Forms question...


	OK.  If I am using the POST method and the checkbox 'name' for all
of the checkboxes is 'system', how do I access the results?  I am
researching on the PHP site trying to figure out what this array is, and how
I access this if the index name is the same for all elements.  I am hoping
that this data will be in an array and I can simply loop through the
contents of the array.  If this data is stored in a hash (Perl word for this
type of array, not sure if it's the same in PHP), how do I access this data
since the index for every element would be the same?
	I am SURE that I am probably missing some important conceptual
issues here, but still learning as I go.  Unfortunately, this probably means
that I will be completely rewriting this application at least once in the
future.  Oh well, live and learn.  Thanks again for the help.


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux