halo, i am the newbie here. I got sumting to ask regarding the approvement and deletion for my database.
I'd created a database, and the database contain data that need approval and delete from the admistrator. I use looping to retrieve all the data. PHP code as shown below:

while($row = mysql_fetch_array($result)){
	echo "<tr><td>";
	echo $row['username'];
	echo "</td><td>";
	echo $row['password'];
	echo "</td><td>";
	echo $row['amount'];
	echo "</td><td>";
	echo $row['specification'];
	echo "</td><td>";
	echo "<br />";
}

so each time i loop through the data, i need either a checkbox or radio button so that admin can have an action towards the data. Then the selected data will be pass to another table as well. How can i implement such things? may i need guidance from experts here? thank you

halo, i am the newbie here. I got sumting to ask regarding the approvement and deletion for my database.
I'd created a database, and the database contain data that need approval and delete from the admistrator. I use looping to retrieve all the data. PHP code as shown below:

while($row = mysql_fetch_array($result)){
	echo "<tr><td>";
	echo $row['username'];
	echo "</td><td>";
	echo $row['password'];
	echo "</td><td>";
	echo $row['amount'];
	echo "</td><td>";
	echo $row['specification'];
	echo "</td><td>";
	echo "<br />";
}

so each time i loop through the data, i need either a checkbox or radio button so that admin can have an action towards the data. Then the selected data will be pass to another table as well. How can i implement such things? may i need guidance from experts here? thank you

It would be helpful if you'd show what your html output should look like.
Also, you'll need to present it in some type of form with a record id embedded for each row.
In addition, you'll probably want to present only a subset of records to the user if your table data is large.

So...

Send what you'd like the output to look like first, and then we can go from there.

Below is an example of what I mean although I'm unsure why you need to output the password:

Test.html (This HTML code would be generated by a PHP script)

<html>
  <head>
    <title>Test Page</title>
    <style type="text/css">
       body {margin:10px;}
    </style>
  </head>
  <body>
    <form id="records" action="someAction.php" method="post" >
      <table border="1" cellpadding="2" cellspacing="0" id="datarows">
        <tbody>
        <thead>
        <tr>
        <th>Delete?</th>
        <th>User Name</th>
        <th>Password</th>
        <th>Amount</th>
        <th>Specification</th>
        </tr>
        </thead>
        <tr>
          <td><input type="checkbox" name="1234"></td>
          <td>John Doe</td>
          <td>*****</td>
          <td>100.23</td>
          <td>????</td>
        </tr>
        <tr>
          <td><input type="checkbox" name="1235"></td>
          <td>Mary Jane</td>
          <td>*****</td>
          <td>130.03</td>
          <td>????</td>
        </tr>
        <tr>
          <td><input type="checkbox" name="1231"></td>
          <td>Jack Johnson</td>
          <td>*****</td>
          <td>5000.22</td>
          <td>????</td>
        </tr>
        </tbody>
    	</table>
    	<input type="submit" name="submit" value="Process Records">
    </form>
  </body>
</html>

SomeAction.php

<?php

  /*
    The $_REQUEST var values should be sanitized first,
    but I'm just showing the basic idea...
  */

  foreach ($_REQUEST as $key => $value) {

    if (strtolower($key) == 'submit') {
      break; // exit loop if submit button
    } 
  
    echo 'Record ID = ' . $key . ' selected for deletion<br>';
  }

?>

Darrell

below will be the code:

<?php
mysql_connect("localhost", "root", "1234") or die(mysql_error());
mysql_select_db("userlist") or die(mysql_error());
$query = "SELECT user.username, user.password ,claim.department, claim.duemonth, claim.category, claim.amount, claim.specification ".
 "FROM user, claim ".
	"WHERE user.username = claim.username";
	 
$result = mysql_query($query) or die(mysql_error());
echo "<br /><br /><br /><br /><br /><br /><br /><br /><br /><br />";
echo "<center><b>Welcome to the Administrator page</b></center>";
echo "<br />";
echo "<center>Below will be a list of users with the claims pending for approval...";
echo "<br />";
echo "<br />";
echo "<table border=\"1\" align=\"center\">";
echo "<tr><th>Username</th>";
echo "<th>password</th>";
echo "<th>department</th>";
echo "<th>duemonth</th>";
echo "<th>category</th>";
echo "<th>amount</th>";
echo "<th>specification</th>";
echo "<th>approve</th>";
echo "<th>delete</th></tr>";
// Print out the contents of each row into a table 
while($row = mysql_fetch_array($result)){
	echo "<tr><td>";
	echo $row['username'];
	echo "</td><td>";
	echo $row['password'];
	echo "</td><td>";
	echo $row['department'];
	echo "</td><td>";
	echo $row['duemonth'];
	echo "</td><td>";
	echo $row['category'];
	echo "</td><td>";
	echo $row['amount'];
	echo "</td><td>";
	echo $row['specification'];
	echo "</td><td>";
	echo "</td><td>";
	echo "<br />";
}
?>
<html>
<head>
<title>::. ISO CLAIM PAGE</title>
<link rel="stylesheet" type="text/css"
href="my.css">
</head>
<body>
</body>
</html>

my interface will be like the one i attached. Thank you

Since you've included approval & delete columns, the appropriate element to use would probably be a radio button.

As I stated, you'll definitely need some type of unique identifier.
Otherwise, how else will the processing script know which records to approve / delete?

I have to go run some errands, but I'll give it a shot later when I return.


Darrell

ya...i knew i need identifier so that the radio button correspond to the appropriate row. I just dont have any idea on how to add it in using PHP..thanks ya dude.

This article has been dead for over six months. Start a new discussion instead.