waa1990 waa1990 - 1 year ago 54
HTML Question

Is there a way to find out POST variables without knowing their names?

I have a form that gets its names for checkboxes dynamically. Is there a way to find out the names of the unknown variables? For example:

foreach($value as $option){
$html .= "<input type='checkbox' name='".$key."[]' value='$option'>".htmlspecialchars($option)."</input>";

I need to know what the
would be.

Answer Source

Use the predefined variable $_POST and loop over :

foreach($_POST as $key => $value)
    // $key will be the name
    // $value will be the value of $_POST[$key]
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download