RebeccaRol RebeccaRol - 1 year ago 67
PHP Question

Access name attribute from html form with PHP

Using PHP Codeigniter, I have a form with multiple numeric inputs, each with unique name:

<td><input type="number" style= 'width: 40px' name="order<?php echo $bannerId?>" value="<?php echo $banner->b_order; ?>"</td>

I can access the field value using:


but is there a way in PHP to access the name attribute itself, instead of the value?
So in the controller I can use the $bannerId variable echoed in the form.

Answer Source

Using array keys you could get all the 'names' and then loop over them?

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download