Re: [PHP] checkboxes into MySQL

2001-01-15 Thread Kevin McCarthy

it took me a while to find this out, too.

If you have say, 5 checkboxes, name them like so:







when submitted, in the script processing the form, check the array 
$musicians[]. The checked selections will be included as elements.

So if trane and bird were checked, you will have a 2-element array in 
$musicians[].
$musicians[0] == "trane"
$musicians[1] == "bird"

HTH.

At 02:03 PM 1/15/2001 -0800, Jerry Lake wrote:
>I know this has been discussed,
>but it messing with me.
>
>in a script I'm working on
>I pull out an array of checkboxes
>from a database,
>
>how do I store what people select
>back to the DB
>
>all I end up with is the last selection
>of the array.
>
>Jerry Lake
>
>-Original Message-
>From: jeremy brand [mailto:[EMAIL PROTECTED]]
>Sent: Monday, January 15, 2001 1:57 PM
>To: WreckRman2
>Cc: 'Php-General@Lists. Php. Net'
>Subject: Re: [PHP] Array...
>
>
>for ($i=100; $i>0; $i++)
>   print "\n";
>
>But, I presume you would rather do this:
>for ($i=100; $i>0; $i++)
>   print "\n";
>
>because I can't imagine why you would want to escape double quotes in
>HTML.
>
>Jeremy
>
>Jeremy Brand :: Sr. Software Engineer :: 408-245-9058 :: [EMAIL PROTECTED]
>http://www.JeremyBrand.com/Jeremy/Brand/Jeremy_Brand.html for more
>Get your own Free, Private email at http://www.smackdown.com/
>- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>""   -- Quoted from Yahoo! homepage, http://www.yahoo.com
>
>On Mon, 15 Jan 2001, WreckRman2 wrote:
>
> > Date: Mon, 15 Jan 2001 16:48:21 -0500
> > From: WreckRman2 <[EMAIL PROTECTED]>
> > To: "'Php-General@Lists. Php. Net'" <[EMAIL PROTECTED]>
> > Subject: [PHP] Array...
> >
> >
> > How can I do an array like below 100-1?
> >
> > 
> > 
> > 
> > 
> >
> > to
> >
> > 
> > 
> > 
> >
> >   WreckRman2
> >   Combat Flight Center
> >   http://www.combatfs.com
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]

Kevin McCarthy  Body & Soul
http://www.bodynsoul.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] checkboxes into MySQL(trying again)

2001-01-15 Thread jeremy brand

Hi Jerry,

Feel free (as in GPL) to use my libHtmlForm functions.  This should
solve your problem.

http://www.nirvani.net/software/libHtmlForm/

See: html_input_checkbox() specifically.

Jeremy

Jeremy Brand :: Sr. Software Engineer :: 408-245-9058 :: [EMAIL PROTECTED]
http://www.JeremyBrand.com/Jeremy/Brand/Jeremy_Brand.html for more 
Get your own Free, Private email at http://www.smackdown.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
   ""   -- Quoted from Yahoo! homepage, http://www.yahoo.com

On Mon, 15 Jan 2001, Jerry Lake wrote:

> Date: Mon, 15 Jan 2001 14:11:18 -0800
> From: Jerry Lake <[EMAIL PROTECTED]>
> To: "'Php-General@Lists. Php. Net'" <[EMAIL PROTECTED]>
> Subject: [PHP] checkboxes into MySQL(trying again)
> 
> sorry about that,
> I forgot to erase the old post
> info
> 
> here is a chunk of the code I am using
> 
> //inclusion of pizza toppings from DB
> $query = ("SELECT * FROM toppings");
> $result2 = mysql_db_query($DBName, $query) or
> die("Error in MySQL query");
> 
> echo "";
> echo "";
> 
> $colors = array( '#e4e4e4', '#ff' );
>  
> $i = 0;
> 
> while($myrow =  mysql_fetch_array($result2)) {
>   $counter++;
>   if ($counter > "4") {
>  $counter = "1";
>   echo "";
>   }
> $name = $myrow["name"];
> $personal_cost = $myrow["personal_cost"];
> $small_cost = $myrow["small_cost"];
> $medium_cost = $myrow["medium_cost"];
> $large_cost = $myrow["large_cost"];
> $category = $myrow["category"];
> 
> 
> 
> echo "\r\n";
> echo "".$name."";
> echo "\r\n";
> }
> if ($counter < 3) {
> while ($counter < 3) {
>   echo " ";
>   $counter++;
> }
> }
> echo "";
> 
> echo "";
> // memory flush
> mysql_free_result($result2);
> //end topping section
> 
> 
> Jerry Lake- [EMAIL PROTECTED]
> Web Designer
> Europa Communications - http://www.europa.com
> Pacifier Online   - http://www.pacifier.com
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] checkboxes into MySQL(trying again)

2001-01-15 Thread Jerry Lake

sorry about that,
I forgot to erase the old post
info

here is a chunk of the code I am using

//inclusion of pizza toppings from DB
$query = ("SELECT * FROM toppings");
$result2 = mysql_db_query($DBName, $query) or
die("Error in MySQL query");

echo "";
echo "";

$colors = array( '#e4e4e4', '#ff' );
 
$i = 0;

while($myrow =  mysql_fetch_array($result2)) {
$counter++;
if ($counter > "4") {
   $counter = "1";
echo "";
}
$name = $myrow["name"];
$personal_cost = $myrow["personal_cost"];
$small_cost = $myrow["small_cost"];
$medium_cost = $myrow["medium_cost"];
$large_cost = $myrow["large_cost"];
$category = $myrow["category"];



echo "\r\n";
echo "".$name."";
echo "\r\n";
}
if ($counter < 3) {
while ($counter < 3) {
echo " ";
$counter++;
}
}
echo "";

echo "";
// memory flush
mysql_free_result($result2);
//end topping section


Jerry Lake- [EMAIL PROTECTED]
Web Designer
Europa Communications - http://www.europa.com
Pacifier Online - http://www.pacifier.com



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] checkboxes into MySQL

2001-01-15 Thread jeremy brand

What I see is that the below is not an array of checkboxes (that would
be , not ).   ... are
part of a 

But, to make a checkbox be checked, you simply do this:


Jeremy

Jeremy Brand :: Sr. Software Engineer :: 408-245-9058 :: [EMAIL PROTECTED]
http://www.JeremyBrand.com/Jeremy/Brand/Jeremy_Brand.html for more 
Get your own Free, Private email at http://www.smackdown.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
   ""   -- Quoted from Yahoo! homepage, http://www.yahoo.com

On Mon, 15 Jan 2001, Jerry Lake wrote:

> Date: Mon, 15 Jan 2001 14:03:00 -0800
> From: Jerry Lake <[EMAIL PROTECTED]>
> To: "'Php-General@Lists. Php. Net'" <[EMAIL PROTECTED]>
> Subject: [PHP] checkboxes into MySQL
> 
> I know this has been discussed,
> but it messing with me.
> 
> in a script I'm working on
> I pull out an array of checkboxes
> from a database,
> 
> how do I store what people select
> back to the DB
> 
> all I end up with is the last selection
> of the array.
> 
> Jerry Lake 
> 
> -Original Message-
> From: jeremy brand [mailto:[EMAIL PROTECTED]]
> Sent: Monday, January 15, 2001 1:57 PM
> To: WreckRman2
> Cc: 'Php-General@Lists. Php. Net'
> Subject: Re: [PHP] Array...
> 
> 
> for ($i=100; $i>0; $i++)
>   print "\n";
> 
> But, I presume you would rather do this:
> for ($i=100; $i>0; $i++)
>   print "\n";
> 
> because I can't imagine why you would want to escape double quotes in
> HTML.
> 
> Jeremy
> 
> Jeremy Brand :: Sr. Software Engineer :: 408-245-9058 :: [EMAIL PROTECTED]
> http://www.JeremyBrand.com/Jeremy/Brand/Jeremy_Brand.html for more 
> Get your own Free, Private email at http://www.smackdown.com/
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>""   -- Quoted from Yahoo! homepage, http://www.yahoo.com
> 
> On Mon, 15 Jan 2001, WreckRman2 wrote:
> 
> > Date: Mon, 15 Jan 2001 16:48:21 -0500
> > From: WreckRman2 <[EMAIL PROTECTED]>
> > To: "'Php-General@Lists. Php. Net'" <[EMAIL PROTECTED]>
> > Subject: [PHP] Array...
> > 
> > 
> > How can I do an array like below 100-1?
> > 
> > 
> > 
> > 
> > 
> > 
> > to
> > 
> > 
> > 
> > 
> > 
> > WreckRman2
> > Combat Flight Center
> > http://www.combatfs.com
> > 
> > -- 
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> > 
> > 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] checkboxes into MySQL

2001-01-15 Thread Jerry Lake

I know this has been discussed,
but it messing with me.

in a script I'm working on
I pull out an array of checkboxes
from a database,

how do I store what people select
back to the DB

all I end up with is the last selection
of the array.

Jerry Lake 

-Original Message-
From: jeremy brand [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 15, 2001 1:57 PM
To: WreckRman2
Cc: 'Php-General@Lists. Php. Net'
Subject: Re: [PHP] Array...


for ($i=100; $i>0; $i++)
  print "\n";

But, I presume you would rather do this:
for ($i=100; $i>0; $i++)
  print "\n";

because I can't imagine why you would want to escape double quotes in
HTML.

Jeremy

Jeremy Brand :: Sr. Software Engineer :: 408-245-9058 :: [EMAIL PROTECTED]
http://www.JeremyBrand.com/Jeremy/Brand/Jeremy_Brand.html for more 
Get your own Free, Private email at http://www.smackdown.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
   ""   -- Quoted from Yahoo! homepage, http://www.yahoo.com

On Mon, 15 Jan 2001, WreckRman2 wrote:

> Date: Mon, 15 Jan 2001 16:48:21 -0500
> From: WreckRman2 <[EMAIL PROTECTED]>
> To: "'Php-General@Lists. Php. Net'" <[EMAIL PROTECTED]>
> Subject: [PHP] Array...
> 
> 
> How can I do an array like below 100-1?
> 
> 
> 
> 
> 
> 
> to
> 
> 
> 
> 
> 
>   WreckRman2
>   Combat Flight Center
>   http://www.combatfs.com
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]