开发者

problem accessing check-boxes values in some installations

开发者 https://www.devze.com 2023-03-08 02:56 出处:网络
I have following structure for check-boxes <input type=\"checkbox\" name=\"reg_field[\'first_name开发者_如何学Go\']\" value=\"1\" /> First Name<br />

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'];
0

精彩评论

暂无评论...
验证码 换一张
取 消