Hi all,
In a pickle.
I have a button for every record retrieved from the database:
<input name=\"delete\" type=\"submit\" value=\"Delete\">
When one button is clicked, I would like the record to be deleted from the database by passing the userid to my function:
function DeleteUser($userid) {
$sqlquery = "DELETE FROM users WHERE userid= $userid";
$result = mysql_query($sqlquery, $_SESSION['S_REMOTE_DB']);
if ($result) {
$blnresult = true;
} else {
$blnresult = false;
}
return $blnresult;
}
I simply need to know how to pass the userid from my button to the query in order for it to execute - can anyone advise?
I have this code at the tope of my page:
if (isset($_POST['delete'])) {
$success = DeleteUser($userid);
}
Is this correct?
Any advice would be greatfully received.
Cheers