Re: Two word array Value

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

 



On Wed, May 14, 2008 at 4:02 PM, Mark Bomgardner <mbomgardner@xxxxxxxxx> wrote:
> I am trying to use array's to populate a group of check boxes for a form.  I
>  am getting the checkboxes to print OK, but when the form is posted I am only
>  getting part of the array.
[snip!]

    Looks like someone's working with the police academy, or something
similar.  Reminds me.... I think I have to recert my CEVO and EVOC....

    Anyway, using spaces in HTML form name and ID compartments is
illegal, and you're not encapsulating the data in quotes.  So HTML
thinks that the first word of the bunch is the name of the form
element, then skips the rest.  For valid HTML:

<?php
// foreach....
echo "<td><input name=\"".str_replace(' ','_',$key)."\"
type=\"checkbox\" value=\"".$value."\"></td><td>".$value."</td>";
?>

    Otherwise, if you still want to use spaced form field names, you
can enclose them in quotes (as shown above) and the browser will
probably automatically urlencode() the data on submit.

-- 
</Daniel P. Brown>
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux