How to automatically increment checkbox id in a table - php

I'm using this code to get all data from database and display it in a table:
class Product
{
private $conn;
private $id;
private $name;
private $description;
private $price;
private $category_id;
private $category_name;
private $created;
public function __construct($db)
{
$this->conn = $db;
}
public function readAll()
{
$stmt = $this->conn->prepare('SELECT name, description, price, CategoryID, created FROM products');
$stmt->execute();
echo "<table class=\"highlight responsive-table\">
<thead>
<tr>
<th data-field=\"empty\"> </th>
<th data-field=\"name\">Name</th>
<th data-field=\"description\">Description</th>
<th data-field=\"price\">Price</th>
<th data-field=\"category\">Category</th>
<th data-field=\"action\">Action</th>
</tr>
</thead>";
while ($result = $stmt->fetch(PDO::FETCH_ASSOC)) {
$n = $result['name'];
$d = $result['description'];
$p = $result['price'];
$ca = $result['CategoryID'];
$c = $result['created'];
echo "<tbody>
<tr>
<td style=\"width:10%;\">
<input type=\"checkbox\" id=\"checkbox\" />
<label for=\"checkbox\"></label>
</td>
<td style=\"width:15%;\">" .$n. "</td>
<td style=\"width:30%;\">" . $d. "</td>
<td style=\"width:10%;\">" ."$".$p. "</td>
<td style=\"width:15%;\">" . $ca. "</td>
<td style=\"width:20%;\">
<a class=\"waves-effect waves-light btn\"><i class=\"material-icons\">mode_edit</i></a>
<a class=\"waves-effect waves-light btn\"><i class=\"material-icons\">delete</i></a>
</td>";
}
echo "</tbody> </table>";
}
}
It's working, but in the 1st column I want to have a checkbox so I can mark records I want to delete / edit, but for now, whichever checkbox I click, only the 1st one get checked. How can I automatically increment checkbox id?

I would recommend using the id field from the products table. If it doesn't have one, I would add it.
Then in your html change the checkbox line to:
<input type=\"checkbox\" id=\"checkbox".$id."\" name=\"delete_product\" value=\"".$id".\" />
<label for=\"checkbox".$id."\"></label>
I added name and value in case you are submitting the form, you can get that data in the POST if you end up using a form.

use a variable $i, initialize it with 1 before while loop and
inside your loop,increment it
replace your checkbox code like
<input type=\"checkbox\" id=\"checkbox_$i\" />
<label for=\"checkbox_$i\"></label>
$i++;

Try using a counting variable like this:
$i = 0;
while ($result = $stmt->fetch(PDO::FETCH_ASSOC)) {
$n = $result['name'];
$d = $result['description'];
$p = $result['price'];
$ca = $result['CategoryID'];
$c = $result['created'];
echo "<tbody>
<tr>
<td style=\"width:10%;\">
<input type=\"checkbox\" id=\"checkbox".$i."\" />
<label for=\"checkbox".$i."\"></label>
</td>
<td style=\"width:15%;\">" .$n. "</td>
<td style=\"width:30%;\">" . $d. "</td>
<td style=\"width:10%;\">" ."$".$p. "</td>
<td style=\"width:15%;\">" . $ca. "</td>
<td style=\"width:20%;\">
<a class=\"waves-effect waves-light btn\"><i class=\"material-icons\">mode_edit</i></a>
<a class=\"waves-effect waves-light btn\"><i class=\"material-icons\">delete</i></a>
</td>";
$i++;
}

Add id column to your sql query. Then modify your first column in table to
<input type=\"checkbox\" id=\"checkbox\" . $result['id'] . " name=\"id[" . $result['id'] . "]\"/>
<label for=\"checkbox" . $result['id'] . "\"></label>
In Controller you will have access to selected ids using for example $_POST['id']

Related

Foreach and skip specific HTML

I am using a foreach to elaborate some values scraped from a web site. It works but I have the follow problem (I put screens to explain my problem in the best way).
In the first screen, you can see that Derry City - Limerick doesn't have 1 X 2 odds
But when I get that values, my code fill empty odds with the first odds available, see the screen below:
This is the HTML code:
<table class="table-main js-tablebanner-t js-tablebanner-ntb">
<tr><th class="h-text-left" colspan="2">2. Round</th><th> </th><th class="table-main__bs">B's</th><th class="h-text-center">1</th><th class="h-text-center">X</th><th class="h-text-center">2</th></tr>
<tr>
<td class="table-main__datetime">21.03.2017 20:45</td>
<td class="h-text-left"><span>Derry City</span> - <span>Limerick</span></td>
<td class="h-text-right">
<ul class="list-tags"><li class="list-tags__item"><i class="icon icon__stream"></i><div class="list-tags__window list-tags__window--streams"><ul class="list-tags__window__in">
<li>Live streams</li>
<li>bwin</li>
<li>Sportingbet</li>
</ul></div></li></ul>
</td>
<td class="table-main__bs"> </td>
<td class="table-matches__odds" data-oid=""> </td>
<td class="table-matches__odds" data-oid=""> </td>
<td class="table-matches__odds" data-oid=""> </td>
</tr>
<tr><th class="h-text-left" colspan="2">5. Round</th><th> </th><th class="table-main__bs">B's</th><th class="h-text-center">1</th><th class="h-text-center">X</th><th class="h-text-center">2</th></tr>
<tr>
<td class="table-main__datetime">18.03.2017 15:00</td>
<td class="h-text-left"><span>Limerick</span> - <span>Finn Harps</span></td>
<td class="table-matches__odds" data-oid="2kou5xv464x0x5uaff"></td>
<td class="table-matches__odds" data-oid="2kou5xv498x0x0"></td>
<td class="table-matches__odds" data-oid="2kou5xv464x0x5uafg"></td>
</tr>
<tr>
<td class="table-main__datetime">18.03.2017 16:00</td>
<td class="h-text-left"><span>Derry City</span> - <span>Drogheda</span></td>
<td class="table-main__bs">23</td>
<td class="table-matches__odds" data-oid="2kp2nxv464x0x5uaoj"></td>
<td class="table-matches__odds" data-oid="2kp2nxv498x0x0"></td>
<td class="table-matches__odds" data-oid="2kp2nxv464x0x5uaok"></td>
</tr>
and, at least, this is my code:
$match_dates = $html->find("td[class=table-main__datetime]");
$titles = $html->find("a[class=in-match]"); // 1 per match
$odds = $html->find("td[class=table-matches__odds]/a"); // 2
function print_odd($odd) {
if (array_key_exists('data-odd', $odd->attr)) {
return $odd->attr['data-odd'];
}
return $odd->children(0)->children(0)->children(0)->attr['data-odd'];
}
$c=0; $b=0; $o=0; $z=0; // two counters
foreach ($titles as $match) {
list($num1, $num2) = explode(':', $res->innertext); // <- explode
list($home, $away) = explode('-', $titles[$z++]->innertext); // <- explode
list($date, $time) = explode('-', $match_dates[$o++]->innertext); // <- explode
$odd1 = print_odd($odds[$b++]);
$odd2 = print_odd($odds[$b++]);
$odd3 = print_odd($odds[$b++]);
$home = strip_tags($home);
$away = strip_tags($away);
$uniquefield = $home . ' ' . $away;
echo "<tr><td class='rtitle'>".
//"<td class='last-cell'>".$match_dates[$o++]->innertext. "</td> " .
"<td> ".$date.'</td><td> : </td><td>'.$time . " / " .
"<td> ".$home.'</td><td> : </td><td>'.$away . " / " .
"<td class='odds'>".$odd1 . ";" .
"".$odd2 . ";" .
"".$odd3 . "</td>" .
"".$uniquefield."</td></tr><br/>";

How to delete records from database using checkbox and button which are not in the form

I have code like this in product.php:
EDIT:
class Product {
private $conn;
private $id;
private $name;
private $description;
private $price;
private $category_id;
private $category_name;
private $created;
public function __construct($db) {
$this->conn = $db;
}
public function readAll()
{
$stmt = $this->conn->prepare('SELECT id, name, description, price, CategoryID, created FROM products');
$stmt->execute();
echo "<table class=\"highlight responsive-table\">
<thead>
<tr>
<th data-field=\"empty\"> </th>
<th data-field=\"name\">Name</th>
<th data-field=\"description\">Description</th>
<th data-field=\"price\">Price</th>
<th data-field=\"category\">Category</th>
<th data-field=\"action\">Action</th>
</tr>
</thead>";
while ($result = $stmt->fetch(PDO::FETCH_ASSOC)) {
$id = $result['id'];
$n = $result['name'];
$d = $result['description'];
$p = $result['price'];
$ca = $result['CategoryID'];
$c = $result['created'];
echo "<tbody>
<tr>
<td style=\"width:10%;\">
<input type=\"checkbox\" id=\"checkbox_".$id."\" name=\"checkbox[]\" />
<label for=\"checkbox_".$id."\"></label>
</td>
<td style=\"width:15%;\">" .$n. "</td>
<td style=\"width:30%;\">" . $d. "</td>
<td style=\"width:10%;\">" ."$".$p. "</td>
<td style=\"width:15%;\">" . $ca. "</td>
<td style=\"width:20%;\">
<a class=\"waves-effect waves-light btn\"><i class=\"material-icons\">mode_edit</i></a>
<a class=\"waves-effect waves-light btn\"><i class=\"material-icons\">delete</i></a>
</td>";
}
echo "</tbody> </table>";
}
public function deleteSelected($ids) {
$query = 'DELETE FROM products WHERE id=?';
$stmt = $this->conn->prepare($query);
if (is_array($ids)) {
foreach ($ids as $id)
$stmt->execute([$id]);
}
else {
$stmt->execute([$ids]);
}
}
}
/* ****** */
if($_SERVER['REQUEST_METHOD'] == 'POST'){
if (isset($_POST['delete']) && !empty($_POST['checkbox'])) {
$checkboxArr = $_POST['checkbox'];
foreach ($checkboxArr as $row) {
$checkIds = explode("_", $row);
$id = $checkIds[1];
$cat = new Product($conn);
//$id = filter_input ( INPUT_POST , 'id', FILTER_SANITIZE_NUMBER_INT );
$cat->deleteSelected($id);
}
}
}
and the button:
<button class="btn-floating btn-large waves-effect waves-light red" type="submit" value="Delete" name="delete">
<a><i class="material-icons">clear</i></a>
</button>
I'm displaying content of database in a table in index.php using readAll function. In 1st column I have checkbox. On the page are also few buttons, one of them is supposed to delete selected records from the database. I can do that using form like this:
<form action="" method="post">
<input type="text" name="id" id="id" placeholder="Please Enter Id"/><br /><br />
<input type="submit" value="Delete" name="delete" id="delete"/><br />
but how can I delete the record, without writing it's id in any form, just by using checkbox (in product.php) and button (in index.php) which is not in the form?
Use name="checkbox[]" and id = "checkbox_".$id.".
Using checkbox[] you will get multiple selected checkbox with its id in comma separated.
class Product {
private $conn;
private $id;
private $name;
private $description;
private $price;
private $category_id;
private $category_name;
private $created;
public function __construct($db) {
$this->conn = $db;
}
public function readAll()
{
$stmt = $this->conn->prepare('SELECT id, name, description, price, CategoryID, created FROM products');
$stmt->execute();
echo " <form action="./objects/product.php" method="post">
<table class=\"highlight responsive-table\">
<thead>
<tr>
<th data-field=\"empty\"> </th>
<th data-field=\"name\">Name</th>
<th data-field=\"description\">Description</th>
<th data-field=\"price\">Price</th>
<th data-field=\"category\">Category</th>
<th data-field=\"action\">Action</th>
</tr>
</thead>";
while ($result = $stmt->fetch(PDO::FETCH_ASSOC)) {
$id = $result['id'];
$n = $result['name'];
$d = $result['description'];
$p = $result['price'];
$ca = $result['CategoryID'];
$c = $result['created'];
echo "<tbody>
<tr>
<td style=\"width:10%;\">
<input type=\"checkbox\" id=\"checkbox_".$id."\" name=\"checkbox[]\" />
<label for=\"checkbox".$id."\"></label>
</td>
<td style=\"width:15%;\">" .$n. "</td>
<td style=\"width:30%;\">" . $d. "</td>
<td style=\"width:10%;\">" ."$".$p. "</td>
<td style=\"width:15%;\">" . $ca. "</td>
<td style=\"width:20%;\">
<a class=\"waves-effect waves-light btn\"><i class=\"material-icons\">mode_edit</i></a>
<a class=\"waves-effect waves-light btn\"><i class=\"material-icons\">delete</i></a>
</td>";
}
echo " <input type="submit" value="Delete" name="delete" id="delete"/></form>";
echo "</tbody> </table>";
}
public function deleteSelected($ids) {
$query = 'DELETE FROM products WHERE id=?';
$stmt = $this->conn->prepare($query);
if (is_array($ids)) {
foreach ($ids as $id)
$stmt->execute([$id]);
}
else {
$stmt->execute([$ids]);
}
}
/* ****** */
In below code we are getting comma separated selected checkbox array and delete it using foreach loop of $_POST['checkbox'] array.
if($_SERVER['REQUEST_METHOD'] == 'POST'){
if ( isset( $_POST['delete']) && !empty( $_POST['checkbox']) ) {
$checkboxArr = $_POST['checkbox'];
foreach($checkboxArr as $id)
{
$cat = new Product($conn);
//$id = filter_input ( INPUT_POST , 'id', FILTER_SANITIZE_NUMBER_INT );
$cat->deleteSelected($id);
}
}
}
Using ajax , you can send a set of ID's to delete to a server code. Bind to the delete buttons onClick event using javascript ( ie. Pure, jQuery)
Or you can also trigger a form submission and set the id's to a hidden input. And do it in a non-ajax fashion.

get and display multiple checkbox values from database using php

i having two check boxes when i am selecting both check boxes i want to show the value related to both from database ,but now i able to print only one id of check boxes i want to show both data can anyone help hoe to show both a value ,Below is my code:
html
<input type="submit" name="Update" src="/image/exporttt.png" style="margin:0px;cursor:pointer">
<tbody>
<?php
$clientid=$_GET['clientid'];
if($clientid!=""){
$sql = mysql_query("SELECT * FROM clientnetworkpricehistory");
while($rows=mysql_fetch_array($sql))
{
if($alt == 1)
{
echo '<tr class="alt">';
$alt = 0;
}
else
{
echo '<tr>';
$alt = 1;
}
echo '
<td id="CPH_GridView1_clientid" style="width:140px" class=" clientid '.$rows["net_id"].'">'.$rows["clientid"].'</td>
<td id="CPH_GridView1_country" style="width:160px" class=" country '.$rows['net_id'].'">'.$rows["country"].'</td>
<td id="CPH_GridView1_networkname" style="width:156px" class="networkname '.$rows["net_id"].'">'.$rows["networkname"].'</td>
<td id="CPH_GridView1_mccmnc" style="width:250px" class=" mcc'.$rows["net_id"].'">'.$rows["mcc"].'</td>
<td id="CPH_GridView1_mccmnc" style="width:250px" class=" mnc '.$rows["net_id"].'">'.$rows["mnc"].'</td>
<td id="CPH_GridView1_oldprice" style="width:320px" class=" oldprice '.$rows["net_id"].'">'.$rows["pricefrom"].'</td>
<td id="CPH_GridView1_newprice" style="width:129px" class=" newprice '.$rows["net_id"].'">'.$rows["priceto"].'</td>
<td id="CPH_GridView1_oldroute" style="width:143px" class="oldsupplierroute '.$rows["net_id"].'">'.$rows["routefrom"].'</td>
<td id="CPH_GridView1_newroute" style="width:143px" class=" newsupplierroute '.$rows["net_id"].'">'.$rows["routeto"].'</td>
<td id="CPH_GridView1_comments" style="width:143px" class=" comments '.$rows["net_id"].'">'.$rows["status"].'</td>
<td id="CPH_GridView1_from" style="width:143px" class=" fromdate '.$rows["net_id"].'">'.date('d.m.Y H:i', $rows["datetime"]).'</td>
<td style="width:65px" class=" '.$rows["net_id"].'"><input type="checkbox" name="chk1" value=" '.$rows["net_id"].'"/></td>
</tr>';
}
}
?>
</tbody>
jssearch.php
<?php
//connecting to db
$variable=$_POST['chk1'];
foreach ($variable as $variablename)
{
$sql_select="SELECT * from clientnetworkpricehistory where net_id=$variablename";
$queryRes = mysql_query($sql_select);
print"$sql_select";
}
echo "<table border='1'>
<tr>
<th>country</th>
<th>networkname </th>
<th>mcc</th>
<th>mnc</th>
<th>datetime </th>
</tr>";
while($row = mysql_fetch_array($queryRes))
{
echo "<tr>";
echo "<td>" . $row['country'] . "</td>";
echo "<td>" . $row['networkname'] . "</td>";
echo "<td>" . $row['mcc'] . "</td>";
echo "<td>" . $row['mnc'] . "</td>";
echo "<td>" . $row['datetime'] . "</td>";
echo "</tr>";
}
echo "</table>";
?>
my out put was(i am checked two checkboxes and i am trying to print two check boxes id it only showing one can any one help me how to do that)
56
Warning: Invalid argument supplied for foreach()
Use name="chk1[]" in your HTML so the checkboxes will be posted as an array.
Besides that:
The mysql_* functions are deprecated, consider using mysqli_* or PDO
You are vulnarable to SQL-injection on your where net_id=$variablename"
I agree with Peter but you also might wanna fix this little typo:
'.$rows['net_id'].'">'.$rows["country"].'
That's line 2 of that large echo you have with all the <td>s. The $rows['net_id'] should be double quotes.
But you knew that...:)

how to give color to table tr?

Hello i have a table with some fields like
here i want make colors for table entire rows..means if ASR value is 75 to 100 should get one color and 50 to 75 should get another color and below 50 should get another color.
and here is my php code
<table width="75%" border="1">
<tr>
<td align="center">channel no</td>
<td align="center">IP</td>
<td align="center">Total calls</td>
<td align="center">Connected calls</td>
<td align="center">Disconnected calls</td>
<td align="center">Duration</td>
<td align="center">ASR</td>
<td align="center">ACD</td>
</tr>
<?php
while ($row = mysql_fetch_assoc($result)) {
//$minutes = gmdate("H:i:s", $row['tduration']);
echo "<tr>
<td>".$row['channel']." </td>
<td>".$row['ip']." </td>
<td>".$row['totalcalls']." </td>";
if ($row['totalcalls']>1){
$sql1 = "SELECT count(duration) as count FROM gateways where duration=0 and ip='".$_POST['ip']."' and channel='".$row['channel']. "' and (connect_datetime BETWEEN ' ".$_POST['toval']." ' and '".$_POST['fromval']."' or disconnect_datetime BETWEEN ' ".$_POST['toval']." ' and '".$_POST['fromval']."' ) Group by channel";
$result1 = mysql_query($sql1, $link);
$norow=mysql_fetch_assoc($result1);
$attenedcalls=($row['totalcalls']-$norow['count']);
echo "<td>".$attenedcalls." </td>";
$disconnectedcalls=($row['totalcalls']-$attenedcalls);
echo "<td>".$disconnectedcalls." </td>";
echo " <td>".$row['tduration']." </td>";
echo "<td>".(($attenedcalls/$row['totalcalls'])*100)."</td>";
}else{
echo "<td>".$row['totalcalls']."</td>";
echo "<td>100</td>";
}
$minutes = gmdate("H:i:s", ($row['tduration']/$attenedcalls));
echo " <td>".$minutes." </td>
</tr>";
}
?>
</table>
thanks in advance
You can try like this
<table width="75%" border="1">
<tr>
<td align="center">channel no</td>
<td align="center">IP</td>
<td align="center">Total calls</td>
<td align="center">Connected calls</td>
<td align="center">Disconnected calls</td>
<td align="center">Duration</td>
<td align="center">ASR</td>
<td align="center">ACD</td>
</tr>
<?php
while ($row = mysql_fetch_assoc($result)) {
$color = '';
if ($row['totalcalls']>1){
$sql1 = "SELECT count(duration) as count FROM gateways where duration=0 and ip='".$_POST['ip']."' and channel='".$row['channel']. "' and (connect_datetime BETWEEN ' ".$_POST['toval']." ' and '".$_POST['fromval']."' or disconnect_datetime BETWEEN ' ".$_POST['toval']." ' and '".$_POST['fromval']."' ) Group by channel";
$result1 = mysql_query($sql1, $link);
$norow=mysql_fetch_assoc($result1);
$attenedcalls=($row['totalcalls']-$norow['count']);
$asr = (($attenedcalls/$row['totalcalls'])*100);
if($asr >= 75 && $asr <=100 ){
$color = 'red';
}else if($asr >= 50 && $asr < 75){
$color = 'cyan';
}else if($asr < 50){
$color = 'blue';
}
}
//$minutes = gmdate("H:i:s", $row['tduration']);
echo "<tr style='background-color : ".$color."'>
<td>".$row['channel']." </td>
<td>".$row['ip']." </td>
<td>".$row['totalcalls']." </td>";
if ($row['totalcalls']>1){
echo "<td>".$attenedcalls." </td>";
$disconnectedcalls=($row['totalcalls']-$attenedcalls);
echo "<td>".$disconnectedcalls." </td>";
echo " <td>".$row['tduration']." </td>";
echo "<td>".$asr."</td>";
}else{
echo "<td>".$row['totalcalls']."</td>";
echo "<td>100</td>";
}
$minutes = gmdate("H:i:s", ($row['tduration']/$attenedcalls));
echo " <td>".$minutes." </td>
</tr>";
}
?>
</table>
[...]
while ($row = mysql_fetch_assoc($result)) {
$asrVal=(($attenedcalls/$row['totalcalls'])*100);
if($asrVal>=50 && $asrVal <=75) $class="from50to75";
if($asrVal>=75 && $asrVal <=100) $class="from75to100";
if($asrVal<50) $class="below50";
//$minutes = gmdate("H:i:s", $row['tduration']);
echo "<tr class='$class'>
[...]
then add:
<style>
tr.from50to75 td{background-color:red;}
tr.from75to100 td{background-color:green;}
tr.below50 td{background-color:blue;}
</style>
Modify your while loop so that you compute the ASR value before emitting the <tr> tag. Use that value to select a class according to the classification you have set up, and emit a tag of the form <tr class=foo> where foo is the class name you have selected. Then it’s just a matter of writing CSS rules for the classes, using class selectors like tr.foo.
(Provided that you have not set color on the td cells. If you have, you need to use selectors like tr.foo td to override such settings.)

hyperlink on every row of mysql data

<?php
require 'database.php';
$query = "SELECT id, date, ponumber FROM so";
$result = $mysqli->query($query) or die(mysqli_error($mysqli));
if ($result) {
echo "<form method='post' action='delete.php'>";
echo "<table cellspacing='0' cellpadding='15' border='1'>
<th >DELETE</th>
<th >VIEW</th>
<th >ID</th>
<th >DATE</th>
<th >PO NUMBER</th>";
while ($row = $result->fetch_object()) {
$date = $row->date ;
$ponumber = $row->ponumber;
$id = $row->id;
//put each record into a new table row with a checkbox
echo "<tr>
<td>
<input type='checkbox' name='checkbox[]' id='checkbox[]' value=$id />
</td>
<td>
$id
</td>
<td>
view
</td>
<td>
$date
</td>
<td>
$ponumber
</td>
</tr>";
}
echo "</table><p><input id='delete' type='submit' class='button' name='delete'
value='Delete Selected Items'/></p></form>";}
?>
i have a sort of an online order form which enable the sales rep to input sales order,
i have done the insert and delete using the code above now i want every row to be a hyperlink so that when they click view it will display only row that has been clicked, in my code above if you click :view" all the detail will display, how can i display only the row that i will click will display the detail of the record!
you need to pass the id in the url and you need to read it if it's there.
e.g.
<?php
require 'database.php';
$query = "SELECT id, date, ponumber FROM so";
/* Edit 1 */
if (!empty($_GET['id'])) {
$query .= " WHERE id = " . mysql_real_escape_string($_GET['id']);
}
/* Edit 1 end */
$result = $mysqli->query($query) or die(mysqli_error($mysqli));
if($result) {
echo "<form method='post' action='delete.php'>";
echo "<table cellspacing='0' cellpadding='15' border='1'>
<th >DELETE</th><th >VIEW</th><th >ID</th><th >DATE</th><th >PO NUMBER</th>";
while ($row = $result->fetch_object()) {
$date = $row->date ;
$ponumber = $row->ponumber;
$id = $row->id;
//put each record into a new table row with a checkbox
echo "<tr>
<td><input type='checkbox' name='checkbox[]' id='checkbox[]' value=$id /></td>
<td>$id</td>
<td>";
/* Edit 2 */
echo "<a href='view.php?id=$id'>view</a>";
/* Edit 2 End */
echo "</td>
<td>$date</td>
<td>$ponumber</td></tr>";
}
echo "</table><p><input id='delete' type='submit' class='button' name='delete' value='Delete Selected Items'/></p></form>";}
?>
A style suggestion:
Don't do/stop doing this:
echo "<form method='post' action='delete.php'>";
echo ...
while
Where what you are echoing is a static string. Instead, do:
?>
<form method='post' action='delete.php'>
...
<?php
while
it's simply easier to read and maintain.

Categories