waa1990 waa1990 - 4 months ago 18
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.


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]