Men sahifamda ro'yxatdan o'tgan foydalanuvchilarni tasdiqlash uchun PHP skriptini yozyapman, lekin ularni tasdiqlamoqchi bo'lganimda biroz muammoga duch keldim. Mana, men imkon qadar.
Jadval:
<?php
mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("activation") or die(mysql_error());
//User Approval Script
$result2 = mysql_query("SELECT * FROM userinfo WHERE status='0'")
or die(mysql_error());
echo "<table border='1'>";
echo "<tr> <th>Name</th> <th>Action</th> <th>Hours</th> <th>Approve</th> </tr>";
while($row = mysql_fetch_array( $result2 )) {
// Print out the contents of each row into a table
echo "<tr><td>";
echo $row['first_name'];
echo "</td><td>";
echo $row['last_name'];
echo "</td>";
echo "<td>";
echo $row['email'];
echo "</td><td>";
echo "<form action=\"approve.php\" method=\"post\"><input name=\"approve[]\" type=\"checkbox\">";
echo "</td></tr>";
}
echo "</table>";
echo "<input type=\"submit\" value=\"Approve\"></form>";
?>
approve.php
<?php
mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("activation") or die(mysql_error());
$ticked = $_POST['approve'];
foreach($ticked as $id) {
mysql_query("UPDATE status SET approved = '1' WHERE `ID` = '$id'");
}
unset($id);
?>
Men tasdiqlangan har bir foydalanuvchiga qanday qilib elektron pochta xabarlarini yuborishim mumkinligini ham bilmoqchiman...
Hammaga oldindan rahmat!
Tahrirlash:
approve.php sahifasi bo'sh va status yangilanmayapti.
mail()
funksiyasidan foydalaning - Ref: php.net/manual/en/function.mail.php - person Krish R   schedule 06.12.2013