Hey, is there any way to combie variables into one? I want to automatically generate forms (display a shipping info box for each order) and then write a script that enters it into the database...I thought I had oent that worked...but it's not, for SOME reason!
Can anyone help me?
here's the code
PHP Code:
<html>
<head>
<title>Lewright Meats</title>
<?php
@include("http://www.lewrightmeats.biz/includes/header.php")
?>
<?php
$cust = 1;
echo("<font class='text20'>Please enter shipping information for the following ordered packages</font>");
$dbcnx = @mysql_connect("localhost", "jlewrigh_pages", "password");
if (!$dbcnx) { echo( "<P>Unable to connect to the database server at this time.</P>" ); exit();}
mysql_select_db("jlewrigh_orders", $dbcnx);
$sql2 = mysql_query("select id, onea, oneb, onec, oned, two, three, four, five, six, seven from packages where cust='$cust' & submitted=0");
if (!$sql2)
{
echo("<P>Error performing query: ".mysql_error()."</P>");
exit();
}
while($curresult= mysql_fetch_array($sql2)) {
$id = $curresult["id"];
$onea = $curresult["onea"];
$oneb = $curresult["oneb"];
$onec = $curresult["onec"];
$oned = $curresult["oned"];
$two = $curresult["two"];
$three = $curresult["three"];
$four = $curresult["four"];
$five = $curresult["five"];
$six = $curresult["six"];
$seven = $curresult["seven"];
echo("<br><font class='text14' color='000000'>");
echo("<form action='/packages/shipping2.php' method=post>");
$sqlcount= 0;
$curcount= 0;
if ($onea > 0) {
echo("9-10 lb. Ham");
while ($curcount < $onea){
echo("<input type='hidden' name='pkg".$sqlcount."' value='onea'><b>Name:</b> <input name='name".$sqlcount."' maxlength='40' size='40'><br><b>Street Address:</b><input name='address1".$sqlcount."' maxlength='40' size='40'><br><b>City, State and ZIP code:</b> <input name='address2".$sqlcount."' maxlength='50' size='50'><br><br>");
$curcount++;
$sqlcount++;
}
}
}
echo("<input type=submit name='submitshipping' value='submit'></form></font>");
if ("submit" == $submitshipping) {
$sqlcount2=1;
while ($sqlcount2 <=$sqlcount) {
echo($cust1);
$sql = "insert into shipping set " . "cust='$cust".$sqlcount2."', " . "pkg='$pkg$sqlcount2', " . "name='$name".$sqlcount2."', " . "address='$address1".$sqlcount2."', " . "address2='$address2".$sqlcount2."'";
if (mysql_query($sql)) { echo("<P class='text16'>Your information has been stored, you may begin using your username and password, click <a href='java_script_:window.close();'>here</a> to close this window.</P>"); } else { echo("<P class='text16'>Error adding user: " . mysql_error() . "</P>"); }
$sqlcount2++;
}
}
?>
<?php
@include("http://www.lewrightmeats.biz/includes/footer.php")
?>
it inserts stuff into my database, but all it inserts is "1" in every column
any suggestions?
THANKS IN ADVANCE!!
Darrin


LinkBack URL
About LinkBacks



Reply With Quote
Bookmarks