problem accessing check-boxes values in some installations
I have following structure for check-boxes
<input type="checkbox" name="reg_field['first_name开发者_如何学Go']" value="1" /> First Name<br />
<input type="checkbox" name="reg_field['last_name']" value="1" /> Last Name<br />
<input type="checkbox" name="reg_field['paypal_email']" value="1"/> PayPal Email<br />
<input type="checkbox" name="reg_field['website_url']" value="1" /> Website URL<br />
<input type="checkbox" name="reg_field['address']" value="1"/> Address<br />
For some installation, I can access these fields as
$reg_new_values = (isset($_POST['reg_field'])?$_POST['reg_field']:array());
echo $reg_new_values["'first_name'"]
but for some installation, it won't work at all?
Is my structure wrong, or do I have to change some settings in PHP.INI
Change the name to something like this reg_field[first_name]
instead of reg_field['first_name']
. Remove the single quotes, by doing that you can access each field name as:
$FirstName = $_POST['reg_field']['first_name'];
精彩评论