I am trying to create an update status feature. The sitename goes in one field, and the status goes in the other. I’ve been able to do it before, but this time I decided to have the sitename come up in a dropdown menu generated through php and a mysqlquery. Here’s the code for the form:
[php]
function PendingLinks(){
global $database;
$q = "SELECT status,name "
.“FROM “.TBL_LINK_EXCHANGE.” WHERE status=‘Pending’ ORDER BY name”;
$result = $database->query($q);
/* Error occurred, return given name by default /
$num_rows = mysql_numrows($result);
if(!$result || ($num_rows < 0)){
echo “Error displaying info”;
return;
}
if($num_rows == 0){
echo “Database table empty”;
return;
}
/ Display table contents */
echo “”;
for($i=0; $i<$num_rows; $i++){
$status = mysql_result($result,$i,“status”);
$webname = mysql_result($result,$i,“name”);
echo “$webname”; }
echo “”;
}
?>
Approve/Reject Item
<?php echo “”;
PendingLinks();
echo “ApprovedRejected”;
echo " ";
echo “”; ?>
I’ve created a process.php, however code that I’ve used before doesn’t seem to work the same when there’s a generated dropdown. I’m trying to get it so that the person can choose the website from a dropdown, then choose whether to approve or reject from the next dropdown, and once submitted, it updates the database. Here’s my code as of right now:
[php]<?php
/* link_exchange_process.php
This file will do the processing for the Link Exchange Manager page. */
include(“session.php”);
class Link_Exchange_Process
{
//Class constructor
function ApproveReject(){
global $session;
//* Make sure administrator is accessing page
if(!$session->isAdmin()){
header(“Location: main.php”);
return;
}
//* Admin submitted Approve/Reject form
if(isset($_POST[‘subupdstatus’])){
$this->procApproval();
}
} //bracket for function approvereject
/*Process for Approval or Rejection of Websites */
function procApproval(){
$webname = $_POST[‘name’];
$status = $_POST[‘status’];
$database->updateUserField($webname, “status”, $status);
} //bracket from procApproval
} //bracket for class
?>[/php]
As usual, thank you in advance for your assistance. As of right now, it doesn’t bring up any error messages, there is just no update.