|
|
Tutorials - Erste Schritte - Arrays - Praxis: EingabefeldTutorials - Erste SchritteArrays: Praxis: Eingabefeld
In der Praxis kann man mit Arrays sehr einfach ein Eingabeformular automatisieren: <?php $Color = array(); $Color['Schrift'] = "white"; $Color['Tabelle'] = "blue"; $Color['Hintergrund'] = "yellow"; echo "<form action=\"\" method=\"post\">"; foreach($Color as $index => $value) { echo "$index --> "; echo "<input type=\"text\" " . "name=\"$index\" " . "value=\"$Color[$index]\">" /* es ginge statt "$Color[$index]" auch "$value" */ . "<br />\n"; } ?> <input type="submit" name="ColSended" value="absenden"><br /> </form> ?> |