Here is the code I am using:
<? include("header.php");
include("members.php");
$a = $_GET['action'];
if($a == '') {
print "<h2>Feed All Pets</h2><p>
<form name='form1'>
<select style='font-size:12px;color:#000000;font-family:verdana;background-color:#ffffff;' name='menu' onChange='location=document.form1.menu.options[document.form1.menu.selectedIndex].value;'><option value=\"\">Choose a Member</option>";
$date = date("y-m-d");
$sql = mysql_query("SELECT * FROM `members` WHERE `validated`='1' ORDER BY `username` ASC");
while($row = mysql_fetch_array($sql)) {
$us = $row["username"];
print "<option value=\"http://www.virtualchinchillas.com/admin/feedall.php?action=feed&username=$us&date=$date\">$us</option>";
}
print "</select></form>";
}
if($a == 'feed') {
$user = $_GET['$username'];
$date = date("y-m-d");
$check= mysql_query("SELECT * FROM pets WHERE `user`='$username'");
$check_num= mysql_num_rows($check);
if ($check_num == "0"){
print "Record could not be found";
}else{
mysql_query("UPDATE `pets` SET `lastfed`='$date' WHERE `user`='$username'") or die (mysql_error());
print "Pets Fed!";
}}
include("footer.php"); ?>
I get the Pets Fed! confirmation but the date doesn't really get updated in the database. Does anyone see why? Thanks for helping a PHP newbie!