Hi first ... sorry for my english :-(
I have a webshop and i wana make a form for all product what i have .
Product name ( textbox ) . after i bit the nr ( qty) in the text box i would to send it to my shoping card ( $_GET $numprod ,$prodid, $basketid ) .
my problem is i can only send 1 product at the time becouse i dont have the product in array.How can put in array all the forms in array than inser into db
can sameone help me to figure out this?
the form :
[PHP]function form( )
{
echo "<table align=\"center\ " border=\"0\" class=\"sadrzaj \" align=\"center\ " width=\"400\" cellpadding=\"3 \">";
echo "<form method=\"post\" action=\"index. php?page=list&a ction=form&op=o rder\" name=\"order\" >\n";
$sql_k = "SELECT ID, NAME FROM shopgroup ORDER BY ID ASC";
$result_k = mysql_query($sq l_k) or die(mysql_error ());
while ($record_k = mysql_fetch_arr ay($result_k)) // list group
{
echo "<table align=\"center\ " border=\"0\" class=\"sadrzaj \" align=\"center\ " width=\"400\" cellpadding=\"3 \">";
echo "<div class=\"nazivi\ "> $record_k[NAME] </div></table>";
$sql_pk = "SELECT * FROM shopcategory WHERE GROUPID = '$record_k[ID]'";
$result_pk = mysql_query($sq l_pk) or die(mysql_error ());
while ($record_pk = mysql_fetch_arr ay($result_pk)) // list categorie
{
$sql_p = "SELECT ID, PRODUCTID, PRICE
FROM shopproduct
WHERE CATID = $record_pk[ID]
ORDER BY PRODUCTID ASC";
$result_p = mysql_query($sq l_p) or die(mysql_error ());
$i = 1;
echo "<table align=\"center\ " border=\"0\" width=\"400\" class=\"listek\ " cellpadding=\"7 \">\n";
echo "<caption >$record_pk[DESC]</caption>";
//echo $customerid;
echo "<tr><td>\n ";
while ($record_p = mysql_fetch_arr ay($result_p)) // list product
{
if($i%4==0)
{
//echo "<table align=\"center\ " border=\"0\" class=\"sadrzaj \" align=\"center\ " width=\"400\" cellpadding=\"3 \">";
echo"<form method=\"post\" action=\"index. php?page=cart&a ction=add\">";
echo "<div class=\"pro\>$r ecord_p[PRODUCTID] <input type=\"text\" name=\"numprod\ " size=\"5\" /><input type=\"submit\" value=\"OK\" name=\"sub\">";
echo "<input type=\"hidden\" name=\"prodid\" value=\"$record _p[ID]\">";
echo"</form></div>"; }
else
// echo "<table align=\"center\ " border=\"0\" class=\"sadrzaj \" align=\"center\ " width=\"400\" cellpadding=\"3 \">";
echo"<form method=\"post\" action=\"index. php?page=cart&a ction=add\">";
echo "<div class=\"pro\ width=\"100\">$ record_p[PRODUCTID] <input type=\"text\" name=\"numprod\ " size=\"5\" /><input type=\"submit\" value=\"OK\" name=\"sub\">";
echo "<input type=\"hidden\" name=\"prodid\" value=\"$record _p[ID]\">";
echo"</form></div>";
$i++;
}
echo "</td></tr>";
echo "</table><br /><br />";
}
}
echo "<hr class=\"red\" />
<div style=\"text-align:right\">
<input type=\"submit\" name=\"sub\" value=\"order all\" class=\"big\" \" />
</form></div><br />\n";
}[/PHP]
and the inster at now for one product
[PHP]$query = "INSERT INTO `".$dbtablespre fix."basket` ( `CUSTOMERID` , `PRODUCTID` , `STATUS` , `ORDERID` , `LINEADDDATE` , `QTY` , `FEATURES`) VALUES ( '" . $customerid . "', '" . $prodid . "', 'BASKET', '0' , '" . Date("d-m-Y @ G:i") . "' , '" . $numprod . "', '".$productfeat ures. "')";[/PHP]
I have a webshop and i wana make a form for all product what i have .
Product name ( textbox ) . after i bit the nr ( qty) in the text box i would to send it to my shoping card ( $_GET $numprod ,$prodid, $basketid ) .
my problem is i can only send 1 product at the time becouse i dont have the product in array.How can put in array all the forms in array than inser into db
can sameone help me to figure out this?
the form :
[PHP]function form( )
{
echo "<table align=\"center\ " border=\"0\" class=\"sadrzaj \" align=\"center\ " width=\"400\" cellpadding=\"3 \">";
echo "<form method=\"post\" action=\"index. php?page=list&a ction=form&op=o rder\" name=\"order\" >\n";
$sql_k = "SELECT ID, NAME FROM shopgroup ORDER BY ID ASC";
$result_k = mysql_query($sq l_k) or die(mysql_error ());
while ($record_k = mysql_fetch_arr ay($result_k)) // list group
{
echo "<table align=\"center\ " border=\"0\" class=\"sadrzaj \" align=\"center\ " width=\"400\" cellpadding=\"3 \">";
echo "<div class=\"nazivi\ "> $record_k[NAME] </div></table>";
$sql_pk = "SELECT * FROM shopcategory WHERE GROUPID = '$record_k[ID]'";
$result_pk = mysql_query($sq l_pk) or die(mysql_error ());
while ($record_pk = mysql_fetch_arr ay($result_pk)) // list categorie
{
$sql_p = "SELECT ID, PRODUCTID, PRICE
FROM shopproduct
WHERE CATID = $record_pk[ID]
ORDER BY PRODUCTID ASC";
$result_p = mysql_query($sq l_p) or die(mysql_error ());
$i = 1;
echo "<table align=\"center\ " border=\"0\" width=\"400\" class=\"listek\ " cellpadding=\"7 \">\n";
echo "<caption >$record_pk[DESC]</caption>";
//echo $customerid;
echo "<tr><td>\n ";
while ($record_p = mysql_fetch_arr ay($result_p)) // list product
{
if($i%4==0)
{
//echo "<table align=\"center\ " border=\"0\" class=\"sadrzaj \" align=\"center\ " width=\"400\" cellpadding=\"3 \">";
echo"<form method=\"post\" action=\"index. php?page=cart&a ction=add\">";
echo "<div class=\"pro\>$r ecord_p[PRODUCTID] <input type=\"text\" name=\"numprod\ " size=\"5\" /><input type=\"submit\" value=\"OK\" name=\"sub\">";
echo "<input type=\"hidden\" name=\"prodid\" value=\"$record _p[ID]\">";
echo"</form></div>"; }
else
// echo "<table align=\"center\ " border=\"0\" class=\"sadrzaj \" align=\"center\ " width=\"400\" cellpadding=\"3 \">";
echo"<form method=\"post\" action=\"index. php?page=cart&a ction=add\">";
echo "<div class=\"pro\ width=\"100\">$ record_p[PRODUCTID] <input type=\"text\" name=\"numprod\ " size=\"5\" /><input type=\"submit\" value=\"OK\" name=\"sub\">";
echo "<input type=\"hidden\" name=\"prodid\" value=\"$record _p[ID]\">";
echo"</form></div>";
$i++;
}
echo "</td></tr>";
echo "</table><br /><br />";
}
}
echo "<hr class=\"red\" />
<div style=\"text-align:right\">
<input type=\"submit\" name=\"sub\" value=\"order all\" class=\"big\" \" />
</form></div><br />\n";
}[/PHP]
and the inster at now for one product
[PHP]$query = "INSERT INTO `".$dbtablespre fix."basket` ( `CUSTOMERID` , `PRODUCTID` , `STATUS` , `ORDERID` , `LINEADDDATE` , `QTY` , `FEATURES`) VALUES ( '" . $customerid . "', '" . $prodid . "', 'BASKET', '0' , '" . Date("d-m-Y @ G:i") . "' , '" . $numprod . "', '".$productfeat ures. "')";[/PHP]
Comment