values from array
Posted: Fri Jul 01, 2005 1:34 pm
Hi all
I'm stuck with silly problem.
I'm retriving data from db and depending on query, returns number of data.
On first page is form with one text field with value 'kolicina' and one hidden field with value 'id'.
On second page is code wich is getting (POST) values of array
How to get values from $_POST['id'] (array) ?
I'm stuck with silly problem.
I'm retriving data from db and depending on query, returns number of data.
On first page is form with one text field with value 'kolicina' and one hidden field with value 'id'.
Code: Select all
<?
echo "<input name=\"id[]\" type=\"text\" id=\"kolicina\" size=\"5\" maxlength=\"2\" value=\"$kolicina\">";
echo "<input type=\"hidden\" name=\"id2[]\" value=\"$id\">";
?>On second page is code wich is getting (POST) values of array
Code: Select all
<?
if (!empty($_POST['id']))
{
echo "Kolicina: " . "<br>\n";
foreach ($_POST['id2'] as $checkbox => $id )
{
$array = explode ($_POST['id']);
echo $id . " - " . $array . "<br>\n";
}
}
?>