How to correctly display data from the mysql database but through the ID number. The ID number is entered on the INPUT(Edit) field in the field. Connection to the database works.
<form action="" method="post">
<input type="number" name="id">
<input type="submit" value"enter">
</form>
<table>
<thead>
<tr>
<td>id</td>
<td>First Name</td>
<td>Last Name</td>
</tr>
</thead>
<tbody>
<?php
require_once('conect.php');
$id = $_POST['id'];
$result = $conn->prepare("SELECT * FROM users WHERE id = $id ORDER BY id DESC ");
$result->execute();
$results = $result->fetchAll();
foreach ($results as $index => $row)
{
?>
<tr>
<td><?php echo $row['id']; ?></td>
<td><?php echo $row['FirstName']; ?></td>
<td><?php echo $row['LastName']; ?></td>
</tr>
<?php } ?>
</tbody>
</table>
The name attribute on the submit button is submit not Submit
Should be
if(isset($_POST['submit']))
Also you should be using prepared statements. Bind the id variable to placeholder.
Related
I get the data from mysql and display it in the table now i'm trying to send it to the database for each student by checking the checkbox, then what should i do to send all table data into the msql database with the different student id
<form class="col-md-12" action="Attendance.php" method="post">
<table id="example" class="myclass table table-striped" />
<thead>
<tr>
<th>ID</th>
<th>Full Name</th>
<th>Father Name</th>
<th><label><input type="checkbox" id="selectAll" name="chbox[]"> All Present </label></th>
</tr>
</thead>
<tbody>
<?php
$SrNo = 0;
global $dbManager;
$sql = "SELECT * FROM studentinfo";
$stmt = $dbManager->query($sql);
while($DataRows = $stmt->fetch()){
$RollNo = $DataRows['id'];
$FullName = $DataRows['fullname'];
$FatherName = $DataRows['fathername'];
?>
<tr>
<td><?php echo $RollNo; ?></td>
<td><?php echo $FullName; ?></td>
<td><?php echo $FatherName; ?></td>
<td><input type="checkbox" name="chbox[]" value="1" /></td>
</tr>
</tbody>
<?php } ?>
<tfoot>
<?php
if(isset($_POST['Submit'])){
$StudentRollNo = $RollNo;
$Attendance = $_POST['chbox'];
// date_default_timezone_set("Asia/Kabul");
$CurrentTime = time();
$DateTime = strftime("%B-%d-%Y %H:%M:%S", $CurrentTime);
if(empty($Attendance)){
$_SESSION['ErrorMessage'] = "Please filled all fields";
RedirectTo("Attendance.php");
}
else{
// the sql code is here.
global $dbManager;
foreach ($Attendance as $key => $value) {
$sql = "INSERT INTO attendance(sid, subjectid, classid, attendance, datetime) VALUES(:studentId,'1','2', :attendancE, :dateTime)";
$stmt = $dbManager->prepare($sql);
$stmt->bindValue(':studentId',$StudentRollNo);
$stmt->bindValue(':attendancE',$value);
$stmt->bindValue(':dateTime',$DateTime);
$Execute = $stmt->execute();
if($Execute){
$_SESSION['SuccessMessage'] = "Attendance Submited Successfully.";
RedirectTo("Attendance.php");
}
else{
$_SESSION['ErrorMessage'] = "Something went wrong. Try Again!";
RedirectTo("Attendance.php");
}
}
}
?>
<tr>
<td>
<i class="fa fa-check"></i>
<input type="submit" name="Submit" value="Save Attendance">
</td>
</tr>
</tfoot>
</table>
</form>
Mysql database: the problem is that the record saves only for one student.
Bring you table inside the while loop where you are fetching the values from the database and then assign the value of students dynamically for the checkbox value
you can do
value="<?php echo $RollNo; ?>";
just like you echo out the other values add the echo into the value field of the checkbox in order to get the values dynamically assigned to each checkbox
I would like to move to the next record using an HTML button. I have tried for and foreach SQL statements I have also tried using num rows and calling the cells values.
$id=$_get['Badge ID Number'];
$sqlkc = "select * from Badges.BADGEMSTR";
$result = mysqli_query($sqlc, $sqlkc);
if($row = mysqli_fetch_array($result, MYSQLI_ASSOC))
{
$BIDN= $row['Badge ID Number'];
$Fname= $row['First Name'];
$MI= $row['Middle Initial'];
$Lname= $row['Last Name'];
}
$next = next($result);
?>
Thank you in advance for your help.
Forgot to add my current onclick command
onclick='<?php echo $next;?>'
All HTML code as requested
<table style="background-color: tan; margin: auto">
<tr>
<td><input type="text" value="<?php echo $BIDN;?>"/>
<input type="text" value="01"/></td>
</tr>
<tr>
<td>
<input type="text" value="<?php echo $Fname;?>"/>
<input type="text" value="<?php echo $MI;?>"/>
<input type="text" value="<?php echo $Lname;?>"/>
</td>
</tr>
<tr>
<td><input type="button" value="Next" style="float: right" onclick='<?php echo $next;?>'/></td>
<td><input type="button" value="Last" style="float: right" onclick='<?php echo $nextid;?>'/></td>
</tr>
</table>
I hope I understood the question right.
Since you would pass the Badge ID between pages, you should use prepared statements as such. So, taking the Badge ID Number is Integer, your PHP code should look like this:
$link = mysqli_connect(hostname,username,password,dbname);
if (isset($_GET['last_id'])) {
// Last row in the table
$stmt = mysqli_prepare($link, 'SELECT * FROM Badges.BADGEMSTR ORDER BY `Badge ID Number` DESC LIMIT 1');
} elseif (isset($_GET['id'])) {
// Specific row in the table
$stmt = mysqli_prepare($link, 'SELECT * FROM Badges.BADGEMSTR WHERE `Badge ID Number`>? ORDER BY Rb ASC LIMIT 1');
$stmt->bind_param('d',$_GET['id']);
} else {
// First row in the table
$stmt = mysqli_prepare($link, 'SELECT * FROM Badges.BADGEMSTR ORDER BY `Badge ID Number` ASC LIMIT 1');
}
// Execute the query and get the results
$stmt->execute();
$result = $stmt->get_result();
$row = $result->fetch_array();
// Initialize variables from the given $row
$BIDN = $row['Badge ID Number'];
$Fname = $row['First Name'];
$MI = $row['Middle Initial'];
$Lname = $row['Last Name'];
As for the HTML code, it's a bit unclear from the question, but I think something like this would be in order:
<html>
<head></head>
<body>
<table style="background-color: tan; margin: auto">
<tr>
<td><?php echo htmlspecialchars($BIDN, ENT_QUOTES); ?></td>
<td>01</td>
</tr>
<tr>
<td><?php echo htmlspecialchars($Fname, ENT_QUOTES); ?></td>
<td><?php echo htmlspecialchars($MI, ENT_QUOTES); ?></td>
<td><?php echo htmlspecialchars($Lname, ENT_QUOTES); ?></td>
</tr>
<tr>
<td>
Next
</td>
<td>
Last
</td>
</tr>
</table>
</body>
</html>
You also don't have to use inputs to display the results, you could show them between TD elements in the table like <td><?php echo $row['Badge ID Number']; ?>.
Im trying to fetch records from database, then i have to upload a image which should be stored in folder and also link to be updated in table.. Everything working fine only with last row.. For first row its not updating.. Please help me where im goin on.. Below is my code
<?php
$email1 = $_SESSION['email'];
$Vendor_id = "SELECT Vendor_id FROM vendors where email = '$email1' ";
$result = mysqli_query($conn, $Vendor_id);
$row = mysqli_fetch_row($result);
$sql = "select Vendor_wallet_id, total_amount, request, amount, status, amt_pdflink from vendor_wallet";
$query = mysqli_query($conn, $sql);
?>
<form action="upload.php" method="post" enctype="multipart/form-data">
<table id="example1" class="table table-bordered table-striped">
<thead>
<tr>
<th>Transfer ID</th>
<th>Request</th>
<th>Amount</th>
<th>Status</th>
<th>Upload</th>
<th>Submit</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_array($query))
{
$cpid = $row['Vendor_wallet_id'];
$tid = $row['request'];
$type = $row['amount'];
$pays = $row['status'];
$amt = $row['amt_pdflink'];
?>
<tr>
<td value="<?php echo $cpid; ?>" name="cpid"><?php echo $cpid; ?></td>
<td><?php echo $tid; ?></td>
<td><?php echo $type; ?></td>
<td><?php echo $pays; ?></td>
<td><input type="file" value="<?php echo $amt; ?>" name="fileToUpload" id="fileToUpload" ></td>
<td><input type="submit" value="Submit" name="submit" >
</button>
</td> </tr>
<?php } ?>
</tbody>
</table>
</form>
upload.php is taken from https://www.w3schools.com/php/php_file_upload.asp
on your form
<?php
$email1 = $_SESSION['email'];
$Vendor_id = "SELECT Vendor_id FROM vendors where email = '$email1' ";
$result = mysqli_query($conn, $Vendor_id);
$row = mysqli_fetch_row($result);
$sql = "select Vendor_wallet_id, total_amount, request, amount, status, amt_pdflink from vendor_wallet";
$query = mysqli_query($conn, $sql);
?>
<form action="upload.php" method="post" enctype="multipart/form-data">
<table id="example1" class="table table-bordered table-striped">
<thead>
<tr>
<th>Transfer ID</th>
<th>Request</th>
<th>Amount</th>
<th>Status</th>
<th>Upload</th>
<th>Submit</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_array($query))
{
$cpid = $row['Vendor_wallet_id'];
$tid = $row['request'];
$type = $row['amount'];
$pays = $row['status'];
$amt = $row['amt_pdflink'];
?>
<tr>
<td value="<?php echo $cpid; ?>" name="cpid"><?php echo $cpid; ?></td>
<td><?php echo $tid; ?></td>
<td><?php echo $type; ?></td>
<td><?php echo $pays; ?></td>
<td><input type="file" name="fileToUpload []" class="fileToUpload" ></td>
<input type="hidden" value="<?php echo $amt; ?>" name="fileToUploadLink []" class="fileToUploadLink" >
<td><input type="submit" value="Submit" name="submit" >
</button>
</td> </tr>
<?php } ?>
</tbody>
</table>
</form>
on upload.php
<?php
if(isset($_FILES['fileToUpload']['tmp_name'])&&isset($_POST['fileToUploadLink'])){
for($i=0;$i<=(count($_FILES['fileToUpload']['tmp_name'])-1);$i++){
move_uploaded_file($_FILES['fileToUpload']['tmp_name'][$i],$_POST['fileToUploadLink'][$i]);
}
}
?>
I have a few suggestions:
In your "php.ini" file, search for the file_uploads directive, and set it to On: file_uploads = On
...</button><!-- <<-- How are you using this? -->
Could try to echo $amt; at the bottom of the loop to see if the path is correct.
May want to check if the $amt with IF Empty condition/statement and maybe check the condition of your other variables.
$email1 = $_SESSION['email'];
$Vendor_id="SELECT Vendor_id FROM vendors where email = '$email1' ";
$result=mysqli_query($conn,$Vendor_id);
$row = mysqli_fetch_row($result);
$sql = "select Vendor_wallet_id, total_amount, request, amount, status, amt_pdflink from vendor_wallet";
$query = mysqli_query($conn, $sql);
?>
<form action="upload.php" method="post" enctype="multipart/form-data">
<table id="example1" class="table table-bordered table-striped">
<thead>
<tr>
<th>Transfer ID</th>
<th>Request</th>
<th>Amount</th>
<th>Status</th>
<th>Upload</th>
<th>Submit</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_array($query))
{
$cpid=$row['Vendor_wallet_id'];
$tid=$row['request'];
$type=$row['amount'];
$pays=$row['status'];
$amt=$row['amt_pdflink'];
?>
<tr>
<td value="<?php echo $cpid; ?>" name="cpid"><?php echo $cpid;?></td>
<td><?php echo $tid;?></td>
<td><?php echo $type;?></td>
<td><?php echo $pays;?></td>
<td><input type="file" value="<?php echo $amt;?>" name="fileToUpload" id="fileToUpload" ></td>
<td><input type="submit" value="Submit" name="submit" >
</button> <!-- WHY IS THIS HERE? -->
</td></tr>
<?php
echo $amt; //See if it is correct path
}//END WHILE ?>
</tbody>
</table>
</form>
There are a few ways in which you could do the file upload, one of which would be to make the form a child of a single table cell and have the file field as a direct child of that form. The submit button, to keep the layout, would not be a child of the form and would need to be changed to a simple button input type then use javascript to submit the form
<?php
$email1 = $_SESSION['email'];
$Vendor_id = "SELECT Vendor_id FROM vendors where email = '$email1' ";
$result = mysqli_query($conn, $Vendor_id);
$row = mysqli_fetch_row($result);
$sql = "select Vendor_wallet_id, total_amount, request, amount, status, amt_pdflink from vendor_wallet";
$query = mysqli_query($conn, $sql);
?>
<table id="example1" class="table table-bordered table-striped">
<thead>
<tr>
<th>Transfer ID</th>
<th>Request</th>
<th>Amount</th>
<th>Status</th>
<th>Upload</th>
<th>Submit</th>
</tr>
</thead>
<tbody>
<?php
while( $row = mysqli_fetch_array( $query ) ) {
$cpid = $row['Vendor_wallet_id'];
$tid = $row['request'];
$type = $row['amount'];
$pays = $row['status'];
$amt = $row['amt_pdflink'];
?>
<tr>
<td value="<?php echo $cpid; ?>" name="cpid"><?php echo $cpid; ?></td>
<td><?php echo $tid; ?></td>
<td><?php echo $type; ?></td>
<td><?php echo $pays; ?></td>
<td>
<form action="upload.php" method="post" enctype="multipart/form-data">
<input type="file" value="<?php echo $amt; ?>" name="fileToUpload" />
</form>
</td>
<td><input type="button" value="Submit" name="submit" /></td>
</tr>
<?php
}
?>
</tbody>
</table>
<script>
var bttns=Array.prototype.slice.call(document.querySelectorAll('input[type="button"][name="submit"]'));
bttns.forEach(function(bttn){
bttn.addEventListener('click',function(evt){
this.parentNode.parentNode.querySelector('form').submit();
}.bind(bttn),false );
});
</script>
Seems like You want to make a form per row.
<tr>
<td value="<?php echo $cpid; ?>" name="cpid"><?php echo $cpid; ?></td>
<td><?php echo $tid; ?></td>
<td><?php echo $type; ?></td>
<td><?php echo $pays; ?></td>
<td colspan="2">
<form action="upload.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="Vendor_wallet_id" value="<?php echo $cpid;?>" />
<input type="file" value="<?php echo $amt; ?>" name="fileToUpload" />
<button>Submit</button>
</form>
</td>
</tr>
</form>
and remove <form> tag that wraps table
Im new in php. this problem stuck me for two days. ergh. I want to display a table that contain input field so that user can insert the data and update it into database. User can change all the data in the table. I want to update multiple rows at a time, but it ends up updating only 1 row (the last row). Anyone please help me for this. Thnks.
This are the form.
This are the following code.
[<table>
<thead>
<tr>
<td><b>Item Code</b></td>
<td><b>Item Barcode</b></td>
<td><b>Item</b></td>
<td><b>QOH</b></td>
<td><b>Quantity</br>Checked</b></td>
<td><b>Quantity</br>Order</b></td>
</tr>
</thead>
<?php
$Barcode=$_SESSION\["Barcode"\];
$code=$_SESSION\["Code"\];
$itemcode=$_SESSION\["Itemcode"\];
$guid=$_SESSION\["guid"\];
$sql = "SELECT itemmastersupcode.*, itembarcode.*, stock_count_item.*, stock_count.*, po_ex_c.*, d.itemlink_total_qty
FROM itemmastersupcode
WHERE stock_count.SupCode = '$code' and stock_count_item.TRANS_GUID = '$guid'
GROUP BY itemmastersupcode.Itemcode";
$result=mysqli_query($conn2,$sql);
$rowcount = mysqli_num_rows($result);
while($row = mysqli_fetch_assoc($result))
{
?>
<tbody>
<tr>
<td><?php echo $row\["Itemcode"\]; ?></td>
<td><?php echo $row\["Barcode"\]; ?></td>
<td><?php echo $row\["Description"\]; ?></td>
<td><?php echo $row\["itemlink_total_qty"\]; ?></td>
<td><?php echo $row\["qty"\]; ?></td>
<form class="form-inline" role="form" method="POST" id="myForm">
<td><input type="number" name="qty" value=""/></td>
</tr>
</tbody>
<input type="hidden" name="itemcode" value="<?php echo $row\["itemcode"\]; ?>"/>
<input type="hidden" name="supcode" value="<?php echo $_SESSION\["Code"\] ?>"/>
<input type="hidden" name="guid" value="<?php echo $_SESSION\["guid"\] ?>"/>
<?php
}
?>
</table>
<button name="save" type="submit" ><b>SUBMIT</b></button>
</form>
<?php
if (isset($_POST\["save"\]))
{
$itemcode=$_POST\['itemcode'\];
$qty=$_POST\['qty'\];
$supcode=$_POST\['supcode'\];
$guid=$_POST\['guid'\];
$sql = "UPDATE stock_count, stock_count_item SET stock_count.posted = '1', stock_count_item.qty_order = '$qty'
WHERE stock_count.TRANS_GUID = '$guid' AND stock_count_item.Itemcode ='$itemcode'
and stock_count_item.TRANS_GUID = '$guid' ";][1]
An UPDATE query will update all records that are filtered by the WHERE clause. If no WHERE is given, all records are updated:
UPDATE table1 SET field1='value1';
will set the field1 column of all records to value1.
UPDATE table1 SET field1='value1' WHERE field2='value2';
will set the field1 column to value1 or all records where field2 is equal to value2.
So, in your case, the records that are found through the WHERE clause are updated. This is all basic SQL stuff by the way, so I advise you to read up on SQL.
Finally, also use prepared statements in your code to prevent SQL injection.
<table>
<thead>
<tr>
<td><b>Item Code</b></td>
<td><b>Item Barcode</b></td>
<td><b>Item</b></td>
<td><b>QOH</b></td>
<td><b>Quantity</br>Checked</b></td>
<td><b>Quantity</br>Order</b></td>
</tr>
</thead>
<?php
$Barcode=$_SESSION["Barcode"];
$code=$_SESSION["Code"];
$itemcode=$_SESSION["Itemcode"];
$guid=$_SESSION["guid"];
$sql = "SELECT itemmastersupcode.*, itembarcode.*, stock_count_item.*, stock_count.*, po_ex_c.*, d.itemlink_total_qty
FROM itemmastersupcode
WHERE stock_count.SupCode = '$code' and stock_count_item.TRANS_GUID = '$guid'
GROUP BY itemmastersupcode.Itemcode";
$result=mysqli_query($conn2,$sql);
$rowcount = mysqli_num_rows($result);
while($row = mysqli_fetch_assoc($result))
{
?>
<tbody>
<tr>
<td><?php echo $row["Itemcode"]; ?></td>
<td><?php echo $row["Barcode"]; ?></td>
<td><?php echo $row["Description"]; ?></td>
<td><?php echo $row["itemlink_total_qty"]; ?></td>
<td><?php echo $row["qty"]; ?></td>
<form class="form-inline" role="form" method="POST" id="myForm">
<td><input type="number" name="itemcode[<?php echo $row["itemcode"]; ?>][qty]" value=""/></td> //update here
</tr>
</tbody>
<?php
}
?>
</table>
<input type="hidden" name="supcode" value="<?php echo $_SESSION["Code"] ?>"/> //update here
<input type="hidden" name="guid" value="<?php echo $_SESSION["guid"] ?>"/>//update here
<button name="save" type="submit" ><b>SUBMIT</b></button>
</form>
Php content
<?php
if (isset($_POST["save"]))
{
$itemcodes=$_POST['itemcode'];
$qty=$_POST['qty'];
$supcode=$_POST['supcode'];
$guid=$_POST['guid'];
$sql = "UPDATE stock_count, stock_count_item SET
stock_count.posted = '1',
stock_count_item.qty_order = CASE stock_count_item.Itemcode";
foreach( $itemcodes as $itmcode=>$qty)
{
$sql.=" WHEN ".$itmcode." THEN ".$qty
}
$sql.=" END WHERE stock_count.TRANS_GUID =$guid AND stock_count_item.TRANS_GUID=$guid AND stock_count_item.Itemcode IN (".implode(",",array_keys( $itemcodes)).") ";
?>
Hope it will help
When I use the sql UPDATE query, it only affects the first row of my members.
<?php
$query = mysqli_query($db, "SELECT * FROM `members` ORDER BY `siteRank`");
$result = mysqli_fetch_assoc($query);
?>
<?php
if($_POST['AccountUpdate'])
{
//mysqli_query($db, "UPDATE members SET username='$Username' WHERE id='$$IdentifcationNumber' ORDER BY id DESC LIMIT 1");
echo $result['id'];
echo $result['username'];
echo 'separeator';
echo $IdentifcationNumber;
}
?>
<form method="post" action="viewprofile.php">
<table border="1px">
<tr>
<th>ID</th>
<th>Username</th>
<th>Password</th>
<th>Email</th>
<th>Browser</th>
<th>IP</th>
<th>Site Rank</th>
<th>PyroCoins</th>
<th>PIN</th>
<th>Status</th>
<th>Date Joined</th>
<th>Update Account</th>
</tr>
<?php
while($result = mysqli_fetch_assoc($query)){
?>
<form method="post" action="viewprofile.php">
<tr>
<td><input readonly="readonly" value="<?php echo $result['id'];?>" /></td>
<td><?php echo $result['username'];?></td>
<td><input text="text" name="ChangePassword" value="<?php echo $result['password'];?>" /></td>
<td><?php echo $result['email'];?></td>
<td><?php echo $result['browser'];?></td>
<td><?php echo $result['ip'];?></td>
<td><?php echo $result['siteRank'];?></td>
<td><input type="text" name="ChangePyroCoins" value="<?php echo $result['PyroCoins'];?>" /></td>
<td><?php echo $result['pin'];?></td>
<td>
Current Status:
<input readonly="readonly" value="<?php echo $result['status'];?>" />
<select name="ChangeStatus">
<option value="<?php echo $result['status'];?>"><?php echo $result['status'];?></option>
<option value="[ Content Deleted ]">[ Content Deleted ]</option>
</select>
</td>
<td><?php echo $result['date'];?></td>
<td><input type="submit" name="AccountUpdate" value="Update Account"></td>
</tr>
<?php
}
?>
</table>
</form>
My $_POST data should be self explanatory, but its only affecting the first row and not the row that Im trying to affect. When I click my html update button, it only displays only the first ID and not the ID or the account credentials that i'm trying to update. For example, When I try to edit somes details with an ID of 28, it affects the first table ID which is 1
'ORDER BY id DESC LIMIT 1' in the query is unnecessary.
UPDATE members SET username='$Username' WHERE id='$IdentifcationNumber'
#Isaak Markopoulos - this is not tested but there are no nested forms so hopefully there should be less confusion when posting the form. The id field in the html has been named so at least there should be an id available in the posted vars
<html>
<head>
<title>crazy little monkey</title>
</head>
<body>
<?php
/* This only gets executed if it is a POST request */
if( $_SERVER['REQUEST_METHOD']=='POST' && isset( $_POST['AccountUpdate'] ) && isset( $_POST['IdentifcationNumber'] ) ){
/* I assume this is the correct id - there was no name for the form element previously */
$IdentifcationNumber=$_POST['IdentifcationNumber'];
$sql="UPDATE members SET username='$Username' WHERE id='$IdentifcationNumber';";
mysqli_query( $db, $sql );
echo $result['id'];
echo $result['username'];
echo 'separeator';
echo $IdentifcationNumber;
}
/* This gets executed for any request */
$query = mysqli_query( $db, "SELECT * FROM `members` ORDER BY `siteRank`;" );
$result = mysqli_fetch_assoc( $query );
?>
<!-- parent table -->
<table border="1px">
<tr>
<th>ID</th>
<th>Username</th>
<th>Password</th>
<th>Email</th>
<th>Browser</th>
<th>IP</th>
<th>Site Rank</th>
<th>PyroCoins</th>
<th>PIN</th>
<th>Status</th>
<th>Date Joined</th>
<th>Update Account</th>
</tr>
<tr>
<td colspan=12>
<!-- begin a form / table for each row in rs -->
<?php
$rc=0;
while( $result = mysqli_fetch_assoc( $query ) ){
$rc++;
echo "
<!-- unique name for each form - not essential -->
<form name='vpf_{$rc}' action='viewprofile.php' method='post'>
<!-- nested child table fully contained within it's parent form element -->
<table>
<td><input type='text' name='IdentifcationNumber' readonly='readonly' value='".$result['id']."' /></td>
<td>".$result['username']."</td>
<td><input text='text' name='ChangePassword' value='".$result['password']."' /></td>
<td>".$result['email']."</td>
<td>".$result['browser']."</td>
<td>".$result['ip']."</td>
<td>".$result['siteRank']."</td>
<td><input type='text' name='ChangePyroCoins' value='".$result['PyroCoins']."' /></td>
<td>".$result['pin']."</td>
<td>
Current Status:
<input readonly='readonly' value='".$result['status']."' />
<select name='ChangeStatus'>
<option value='".$result['status']."'>".$result['status']."
<option value='[ Content Deleted ]'>[ Content Deleted ]
</select>
</td>
<td>".$result['date']."></td>
<td><input type='submit' name='AccountUpdate' value='Update Account'></td>
</table>
</form>";
}/* Close the while loop - note that the form(s) is/are FULLY contained within the loop - NO nesting */
?>
</td>
</tr>
</table>
</body>
</html>