<?php
include ( 'dbconnect.php' );
$query =" select * from customer ";
$result = mysqli_query($db, $query)
or die (" can not find data !!! ");
echo "<h1> here is the data </h1>\n";
echo "<form action='mod1pinfo.php'>\n";
$ctr = 0;
$row = mysqli_fetch_row($result);
echo "<table border='6' cellpadding='10'> ";
while ($row) {
echo "<tr>";
echo "<td> <input type='checkbox' name='mod$ctr'>\n";
echo "<input type='text' name='customerid$ctr' value='$row[0]'></td> \n";
echo "<td><input type='text' name='fname$ctr' value='$row[1]'></td>\n";
echo "<td><input type='text' name='lname$ctr' value='$row[2]'> </td> ";
echo "<td><input type='text' name='pnumber1$ctr' value='$row[3]'> </td> \n";
echo "<td><input type='text' name='pnumber2$ctr' value=' $row[4]'> </td> \n";
echo "<td><input type='text' name='pnumber3$ctr' value='$row[5]'> </td> \n";
echo "<td><input type='text' name='address$ctr' value='$row[6]'> </td> \n";
echo "<td><input type='text' name='City$ctr' value='$row[7]'> </td> \n";
echo "<td><input type='text' name='State$ctr' value='$row[8]'> </td> \n";
echo "<td><input type='text' name='zipcode$ctr' value='$row[9]'> </td> \n";
echo "<td><input type='text' name='shipping$ctr' value='$row[10]'> </td> \n";
echo "<td><input type='text' name='uname$ctr' value='$row[11]'> </td> \n";
echo "<td><input type='text' name='pword$ctr' value='$row[12]'> </td> \n";
$row = mysqli_fetch_row($result);
echo " </tr>\n\n";
$ctr++;
}
echo "<input type='hidden' name='ctotal' value='$ctr'> \n";
echo "<tr><td><input type='submit'></td></tr>\n";
echo "</table> </form>";
//=========================================
include ('endofpageinclude.php');
?>
include ( 'dbconnect.php' ); //$db
$ctr=0;
$ctotal = $_REQUEST['ctotal'];
echo $ctotal;
while($ctr < $ctotal ) {
if ($_REQUEST['mod'.$ctr] == 'on')
{
echo "<br> $ctr was checked\n";
$customerid = $_REQUEST['customerid'.$ctr];
$fname = $_REQUEST['fname'.$ctr];
$lname = $_REQUEST['lname'.$ctr];
$pnumber1 = $_REQUEST['pnumber1'.$ctr];
$pnumber2 = $_REQUEST['pnumber2'.$ctr];
$pnumber3 = $_REQUEST['pnumber3'.$ctr];
$address = $_REQUEST['address'.$ctr];
$City = $_REQUEST['City'.$ctr];
$State = $_REQUEST['State'.$ctr];
$zipcode = $_REQUEST['zipcode'.$ctr];
$shipping = $_REQUEST['shipping'.$ctr];
$uname = $_REQUEST['uname'.$ctr];
$pword = $_REQUEST['pword'.$ctr];
}
} // end while
//Define query
$query = "UPDATE customer SET fname='$fname', lname='$lname', pnumber1='$pnumber1', pnumber2='$pnumber2', pnumber3='$pnumber3', address='$address', City='$City', State='$State', zipcode='$zipcode', shipping='$shipping', uname='$uname', pword='$pword' WHERE customerid='$customerid'";
//executes the query
$results = mysql_query ($query);
$ctr++;
else { //ignore the stuff
echo "<h2> $modcounter records updated </h2> <br>";
}
include ('endofpageinclude.php');
?>
[mod edit] Thank you for using code tags. I just cleaned it up.

New Topic/Question
Reply




MultiQuote






|