Placeholder working, but giving Notice: Undefined variable: value and Notice: Undefined index: #type This is what my code looks like:

foreach ($form["submitted"] as $key =&gt; $value) {
    if ("textarea" == $value["#type"]) {
        $form["submitted"][$key]['#attributes']["placeholder"] = t($value["#title"]);
    }
    if($value['#type'] == "webform_email") {
        $form["submitted"][$key]['#attributes']["placeholder"] = t($value["#title"]);
    }
    if($value['#type'] == "file") {
        $form["submitted"][$key]['#attributes']["placeholder"] = t($value["#title"]);
    } 
}


Why are these errors there and what is the solution? A detailed explanation and working code wouldn't hurt, I am a beginner with Drupal! :-)
There can be some form elements, for examples, markup, without an explicitly set #type. 

foreach ($form["submitted"] as $key =&gt; $value) {
    if (!isset($value["#type"])) { //If #type is not set, skip this iteration. 
      continue;
    }
    if ("textarea" == $value["#type"]) {
        $form["submitted"][$key]['#attributes']["placeholder"] = t($value["#title"]);
    }
    if($value['#type'] == "webform_email") {
        $form["submitted"][$key]['#attributes']["placeholder"] = t($value["#title"]);
    }
    if($value['#type'] == "file") {
        $form["submitted"][$key]['#attributes']["placeholder"] = t($value["#title"]);
    } 
}