Mailinglisten-Archive |
das skript soll zu jedem input feld eine stückzahl liefern
und das ergebnis in einen string übergeben.
da gibt es doch sicherlich eine einfachere schriftweise, oder?!
<?php
$typ = $_POST['typ'];
$stck = $_POST['stck'];
for ($t=0;$t<count($typ);$t++)
{
if ($stck[$t] != "0")
{
$typ_array[] = $stck[$t] . "x " . $typ[$t];
}
}
$typ_array_count = count($typ_array);
for($akf=0;$akf<$typ_array_count;$akf++)
{
$text = $text . $typ_array[$akf] . "<br>\n";
}
echo "Text: $text";
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
typ 1:<input type="text" name="typ[]" value="1"> stck 1:<input type="text" name="stck[]" value="4"><br>
typ 2:<input type="text" name="typ[]" value="2"> stck 2:<input type="text" name="stck[]" value="0"><br>
typ 3:<input type="text" name="typ[]" value="3"> stck 3:<input type="text" name="stck[]" value="5"><br>
<input type="submit" name="ok">
</form>
php::bar PHP Wiki - Listenarchive