i been trying to solve this problem for a few hours but still no progress. Want to Echo out my database result onto a table created in my html however it just pop out on the side of the window. Please advice something i can do. Thank you.
PHP
if (isset($_POST['search'])) {
include 'dbh.php';
$uid =$_POST['name1'];
$nric = $_POST['nric1'];
$number = $_POST['number1'];
$sql = "SELECT * FROM user WHERE name = '$uid' OR nric = '$nric' OR contact = '$number' ";
$result = $conn->query($sql);
if (!$row = mysqli_fetch_assoc($result))
{
echo "No result is found! ";
}
else
{
echo "result found";
$_SESSION['id'] = $row['id'];
echo "<tr>";
echo "<td>".$row['no']."</td>";
echo "<td>".$row['name']."</td>";
echo "<td>".$row['surname']."</td>";
echo "<td>".$row['nric']."</td>";
echo "<td>".$row['contact']."</td>";
echo "<td>".$row['gender']."</td>";
echo "<td>".$row['email']."</td>";
echo "<td>".$row['address']."</td>";
echo "<td>".$row['date']."</td>";
echo "</tr>";
}
}
Inside my form method.
<!-- Search function aboutus about us website -->
<form method="post" action="" >
<div class="panel" id="aboutus">
<h1>About Us</h1>
<!-- end of header -->
<input type="text" name="nric1"
placeholder="NRIC"><br> <input type="text" name="name1"
placeholder="Name"><br>
<input type="text" name="number1" placeholder="Details Number"><br>
<table width = "300" border = "1" cellpadding="1" cellspacing="1">
<tr>
<th>No</th>
<th>Name</th>
<th>Surname</th>
<th>Nric</th>
<th>Contact</th>
<th>Gender</th>
<th>Email</th>
<th>Address</th>
<th>Data</th>
<tr>
</table>
<input type="submit" name="search" value="Search">
</form>
Of course it does that,you need to echo it in the proper place,inside the HTML.Assuming the you also have the HTML inisde the same php page
<form method="post" action="" >
<div class="panel" id="aboutus">
<h1>About Us</h1>
<!-- end of header -->
<input type="text" name="nric1"
placeholder="NRIC"><br> <input type="text" name="name1"
placeholder="Name"><br>
<input type="text" name="number1" placeholder="Details Number"><br>
<table width = "300" border = "1" cellpadding="1" cellspacing="1">
<tr>
<th>No</th>
<th>Name</th>
<th>Surname</th>
<th>Nric</th>
<th>Contact</th>
<th>Gender</th>
<th>Email</th>
<th>Address</th>
<th>Data</th>
<tr>
<?php ...else{
$_SESSION['id'] = $row['id'];
echo "<tr>";
echo "<td>".$row['no']."</td>";
echo "<td>".$row['name']."</td>";
echo "<td>".$row['surname']."</td>";
echo "<td>".$row['nric']."</td>";
echo "<td>".$row['contact']."</td>";
echo "<td>".$row['gender']."</td>";
echo "<td>".$row['email']."</td>";
echo "<td>".$row['address']."</td>";
echo "<td>".$row['date']."</td>";
echo "</tr>";
?>
</table>
<input type="submit" name="search" value="Search">
</form>
Related
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
I have problem with my buttons. I will try to explain.
1)I have users db from postgresql and new db in ms sql.
2)Created site with 2 columns in table ("SELECT * from users"-postgresql ): They are id/user
3)Then added new column "Operator" which contain submit buttons and functionality of submit buttons is updating "access" column from ms sql db.
PROBLEM:
It prints all buttons for all data that I have in ms sql(I have 7 rows data in ms sql, it prints 7 buttons for each row), I need to "echo" 1 button for each row which will be changable. If access==1 it should be named Active , else it should be named Diactive.
Here is my code and picture of what I got:
<?php
<table class="table table-condensed">
<thead>
<tr>
<th>ID</th>
<th>User</th>
<th>Operator</th>
<th>View</th>
</tr>
<?php
while ($row = pg_fetch_array($result)) {
?>
<tr>
<td>
<?php
$id = $row["id"];
echo $id;
?>
</td>
<td>
<?php
$username = $row["username"];
echo $username;
?>
</td>
<td>
<form method="POST" action="oper.php">
<?php
include ("db.php");
$result2 = pg_query($db_connection, "SELECT * from users ORDER by id asc");
while ($row1 = pg_fetch_array($result2))
{
$iddrain= $row1['id'];
//echo $iddrain;
//echo $iddrain;
$q7= "Select access from nezeret where id_m=$iddrain";
//var_dump($q7);
$resultid= sqlsrv_query($link, $q7, $params, $options);
while($row7= sqlsrv_fetch_array($resultid))
{
//$rs7=$row7['ID_M'];
$rs8=$row7['access'];
//echo $rs8;
//break;
if($rs8==1)
{
echo "<p><input type=\"submit\" name=\"uid\" value=Operator-ON onchange=\"this.form.submit()\"></p>
<p><input type=\"hidden\" name=\"uid\" value=$id onchange=\"this.form.submit()\"></p>";
}
else
{
echo "<p><input type=\"submit\" name=\"uid\" value=DIavtive onchange=\"this.form.submit()\"></p>
<p><input type=\"hidden\" name=\"uid\" value=$id onchange=\"this.form.submit()\"></p>";
}
}
}
?>
</form>
</td>
<?php
}
?>
</tr>
</table>
?>
You are doing typo mistake na dnot giving quote for value attributes near :
try like this :
if($rs8==1)
{
echo '<p><input type="submit" name="uid" value="Operator-ON" onchange="this.form.submit()"></p>
<p><input type="hidden" name="uid" value="'.$id.'" onchange=
"this.form.submit()"></p>';
}
else
{
echo '<p><input type="submit" name="uid" value="DIavtive" onchange="this.form.submit()"></p>
<p><input type="hidden" name="uid" value="'.$id.' onchange="this.form.submit()"></p>';
}
}
I have reditted your code to remove some errors that were making it fail to work;
<?php include ("db.php"); ?>
<table class="table table-condensed">
<thead>
<tr>
<th>ID</th>
<th>User</th>
<th>Operator</th>
<th>View</th>
</tr>
</thead>
<?php
//while ($row = pg_fetch_array($result)) {
<?php foreach( pg_fetch_array($result) as $row ) { ?>
?>
<tbody>
<tr>
<td<?php echo $row['id'] ?></td>
<td><?php echo $row['username'] ?></td>
<td>
<form method="POST" action="oper.php">
<?php
$result2 = pg_query($db_connection, 'SELECT * from users ORDER by id asc');
while ($row1 = pg_fetch_array($result2)) {
$iddrain = $row1['id'];
$q7 = "Select access from nezeret where id_m=$iddrain";
//var_dump($q7);
$resultid = sqlsrv_query($link, $q7, $params, $options);
while ($row7 = sqlsrv_fetch_array($resultid)) {
//$rs7=$row7['ID_M'];
$rs8 = $row7['access'];
if ($rs8 == 1) {
echo '<p><input type="submit" name="uid" value=Operator-ON onchange="this.form.submit()"></p>
<p><input type="hidden" name="uid" value=$id onchange="this.form.submit()"></p>';
} else {
echo '<p><input type="submit" name="uid" value=DIavtive onchange="this.form.submit()"></p>
<p><input type="hidden" name="uid" value=$id onchange="this.form.submit()"></p>';
}
}
}
?>
</form>
</td>
</tr>
</tbody>
</table>
I`ve changed code and now it is working, problem was additional useless fetch. Here is the code:
<table class="table table-condensed">
<thead>
<tr>
<th>ID</th>
<th>User</th>
<th>Operator</th>
</tr>
<?php
while ($row = pg_fetch_array($result)) {
?>
<tr>
<td>
<?php
$id = $row["id"];
echo $id;
?>
</td>
<td>
<?php
$username = $row["username"];
echo $username;
?>
</td>
<td>
<form method="POST" action="oper.php">
<?php
include ("db.php");
$iddrain= $row['id'];
$q7= "Select * from nezeret where id_m=$iddrain";
//var_dump($q7);
$resultid= sqlsrv_query($link, $q7, $params, $options);
while($row7= sqlsrv_fetch_array($resultid))
{
$rs8=$row7['access'];
//echo $rs8;
if($rs8==1)
{
echo "<p><input type=\"submit\" name=\"uid\" value=Operator onchange=\"this.form.submit()\"></p>
<p><input type=\"hidden\" name=\"uid\" value=$id onchange=\"this.form.submit()\"></p>";
}
else
{
echo "<p><input type=\"submit\" name=\"uid\" value=Nazeret onchange=\"this.form.submit()\"></p>
<p><input type=\"hidden\" name=\"uid\" value=$id onchange=\"this.form.submit()\"></p>";
}
}
?>
</form>
</td>
</tr>
<?php
}
?>
</tr>
</table>
Can anyone tell me whats the problem with the code below? When I click the delete button, it gives me an error of
undefined index checkbox
even though checkbox is the name of the input tag below.
I know I haven't written the delete query, but thats not the point. I want to echo the $del_id, but I keep getting the error.
<?php
include 'connection.php';
if(isset($_POST['del'])){
$name=$_POST['checkbox'];
$del_id=implode(",", $name);
echo $del_id;
}
$sql="SELECT * FROM `student-reg`";
$result=mysqli_query($conn, $sql) or die(mysqli_error($conn));
echo "<table align='center' border='2'>
<tr>
<th>Mark</th>
<th>ID</th>
<th>First_Name</th>
<th>Last_Name</th>
<th>Roll_no</th>
<th>Degree</th>
</tr>
";
while($row=mysqli_fetch_assoc($result)){
$id=$row['Id'];
echo "
<tr>
<td><input type='checkbox' name='checkbox[]' value='".$row['Id']."'></td>
<td>{$id}</td>
<td>{$row['First_name']}</td>
<td>{$row['Last_name']}</td>
<td>{$row['Roll_no']}</td>
<td>{$row['Degree']}</td>
</tr>
";
}
?>
<html>
<body>
<form method="POST">
<input type="submit" value="Delete" name="del">
</form>
</body>
</html>
you form fields must be in <form></form> tag
<?php
include 'connection.php';
if(isset($_POST['del'])){
$name=$_POST['checkbox'];
$del_id=implode(",", $name);
echo $del_id;
}
$sql="SELECT * FROM `student-reg`";
$result=mysqli_query($conn, $sql) or die(mysqli_error($conn));
echo "<table align='center' border='2'>
<tr>
<th>Mark</th>
<th>ID</th>
<th>First_Name</th>
<th>Last_Name</th>
<th>Roll_no</th>
<th>Degree</th>
</tr>
"; ?>
<form method="post">
<?php
while($row=mysqli_fetch_assoc($result)){
$id=$row['Id'];
echo "
<tr>
<td><input type='checkbox' name='checkbox[]' value='".$row['Id']."'></td>
<td>{$id}</td>
<td>{$row['First_name']}</td>
<td>{$row['Last_name']}</td>
<td>{$row['Roll_no']}</td>
<td>{$row['Degree']}</td>
</tr>
";
}
?>
<html>
<body>
<input type="submit" value="Delete" name="del">
</form>
</body>
</html>
move this before the the closing tag of the script
if(isset($_POST['del'])){
$name=$_POST['checkbox'];
$del_id=implode(",", $name);
echo $del_id;
In a form there is a text field and a table. If we put a value in that text field the corresponding name needs to be displayed on the table:
<form method="post" action="<?php $_SERVER['PHP_SELF']; ?>">
<center><table>
<tr><td>no</td><td><input type="text" name="no" autofocus></td></tr>
</table></center>
<br>
<br>
<center>
<table cellpadding="0" cellspacing="0" width="60%" border='1' bgcolor="#999999">
<thead>
<tr>
<th> Element_Number</th>
</tr>
</thead>
<?php
if(isset($_POST['no']))
{
$c=mysql_connect("localhost","root","");
mysql_select_db("test");
if(!$c)
{
echo "db prob".mysql_error();
}
$no=$_POST['no'];
$qry=mysql_query("select name from opt where no='$no'");
if(!$qry)
{
echo "ret".mysql_error();
}
if(mysql_num_rows($qry)!=0)
{
$row=mysql_fetch_array($qry);
$name=$row['name'];
}
else
{
echo "query Invalid";
}
echo "<td>" .$name."</td></tr>" ;
}
?>
Using this code the value enters in the table but I want to add the name frequently the value to the table as next row when the next value enter to the text field
do it with the help of ajax
<form method="post" action="<?php $_SERVER['PHP_SELF']; ?>">
<center>
<table>
<tr><td>no</td><td><input type="text" name="no" autofocus></td></tr>
<tr><input type="button" name="submit" value="submit"></tr>
</table></center>
</form>
<br>
<br>
<center>
<table id="test_table" cellpadding="0" cellspacing="0" width="60%" border='1' bgcolor="#999999">
<thead>
<tr>
<th> Element_Number</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<script>
$(document).ready(function(){
$('#submit').click(function(){
var no=$('[name="no"]');
$.post('your_current_page_name.php',{"no":no},function(data){
$("#test_table> tbody").append(data);
});
});
});
</script>
<?php
if(isset($_POST['no']))
{
$c=mysql_connect("localhost","root","");
mysql_select_db("test");
if(!$c)
{
echo "db prob".mysql_error();
}
$no=$_POST['no'];
$qry=mysql_query("select name from opt where no='$no'");
if(!$qry)
{
echo "ret".mysql_error();
}
if(mysql_num_rows($qry)!=0)
{
$row=mysql_fetch_array($qry);
$name=$row['name'];
}
else
{
echo "query Invalid";
}
echo "<tr><td>" .$name."</td></tr>" ;
}
I have created a form that update the data in a sql column, so far all good.
The problem I have is that I would like to choose what columns are going to be updated, with checkboxes.
So I want to categorize two files as movies, I just check the checkbox and write movies in the form.
But its not only that. Every column is already connected to a checkbox, but I use this checkbox with an delete query, so I can delete multiple rows.
So my question is more like, how can I combine this two function with "one" checkbox.
This is some of my code.
This is my table with the sql outputs, and with the delete button
<?php
$files = mysql_query("SELECT * FROM files WHERE `user_name` = '{$_SESSION['username']}' ORDER BY `file_time` DESC LIMIT $start, $per_page")
or die(mysql_error());
?>
<table id="table-3">
<thead>
<tr>
<th scope="col">Upload User</th>
<th scope="col">Filename</th>
<th scope="col">Upload date</th>
<th scope="col">IP adress</th>
<th scope="col">Category</th>
<th scope="col">Delete</th>
</tr>
</thead>
<?php
while (($row = mysql_fetch_assoc( $files )) !==false)
{
echo "<tr>";
echo "<td>".$row['user_name'] . "</td> ";
?>
<td class="download"> <?php echo $row['file_name']; ?></td>
<?php echo "<td>".$row['file_time'] . "</td> "; ?>
<?php echo "<td>".$row['file_ip'] . "</td> "; ?>
<?php echo "<td>".$row['category'] . "</td> "; ?>
<td>
<form action="delete.php" method="post">
<input type="checkbox" name="done[]" id="<?php echo $row['file_id'] ?>" value="<?php echo $row['file_id'] ?>">
</td>
<?php
}
echo "</tr>";
echo "</table>";
?>
<input type ="submit" value ="Delete">
</form>
This form is the one with the update function
<form action="function.php" method="post">
category: <input type="text" name="category" />
<input type="submit" />
</form>
and
function.php
include('core/inc/init.inc.php');
if(isset($_POST['category'])){
$category = $_POST['category'];
mysql_query("UPDATE files SET category='$category'
/*WHERE category='genom' */ ");
header("Location: profile.php?uid=" . $_SESSION['uid']);
}else{
header("Location: profile.php?uid=" . $_SESSION['uid']);
};
How can I combine these two functions?
You can have multiple submit buttons in the same form. So you can do something like this:
<?php
$files = mysql_query("SELECT * FROM files WHERE `user_name` = '{$_SESSION['username']}' ORDER BY `file_time` DESC LIMIT $start, $per_page")
or die(mysql_error());
?>
<form action="updateordelete.php" method="post">
<table id="table-3">
<thead>
<tr>
<th scope="col">Upload User</th>
<th scope="col">Filename</th>
<th scope="col">Upload date</th>
<th scope="col">IP adress</th>
<th scope="col">Category</th>
<th scope="col">Delete</th>
</tr>
</thead>
<?php
while (($row = mysql_fetch_assoc( $files )) !==false)
{
?>
<tr>
<td> <?php echo $row['user_name']; ?></td>
<td class="download"> <?php echo $row['file_name']; ?></td>
<td><input type="text" name="file_time[<?php echo $row ['file_id']; ?>]" value="<?php echo $row['file_time']; ?>" /></td>
<td><input type="text" name="file_ip[<?php echo $row ['file_id']; ?>]" value="<?php echo $row['file_ip']; ?>" /></td>
<td><input type="text" name="file_category[<?php echo $row ['file_id']; ?>]" value="<?php echo $row['category']; ?>" /></td>
<td><input type="checkbox" name="done[]" id="<?php echo $row['file_id'] ?>" value="<?php echo $row['file_id'] ?>"></td>
</tr>
<?php } ?>
</table>
<input type ="submit" name="submittype" value = "Update">
<input type ="submit" name="submittype" value = "Delete">
</form>
And then, in updateordelete.php:
if($_POST['submittype']=="Delete"){
(do delete code...)
}elseif($_POST['submittype']=="Update"){
(do update code...)
}
For each of the values, you can access them using $_POST['file_category']. For example:
$file_categories=$_POST['file_category'];
foreach($_POST['done'] as $file_id){
echo $file_categories[$file_id];
}