I changed nothing, and it's now putting the form out correctly - but it's not sending it to the processing page:
This is what the code outputs to the page ([FONT="Courier New"]list-users.php[/FONT]):
<div id="tablecontain">
<p><strong>List of Users</strong></p>
<ol>
<li><a href="list-users.php?uid=1">User One</a>
<form action="exec-user-status.php" method="post">
<input type="hidden" name="memact" value="1" />
<input type="hidden" name="action" value="disable" />
<a href="#" onclick="document.forms[0].submit();">Disable</a>
</form>
</li>
<li>
<a href="list-users.php?uid=2">User Two</a>
<form action="exec-user-status.php" method="post">
<input type="hidden" name="memact" value="2" />
<input type="hidden" name="action" value="disable" />
<a href="#" onclick="document.forms[0].submit();">Disable</a>
</form>
</li>
</ol>
</div>
This is the code of [FONT="Courier New"]exec-user-status.php[/FONT]:
<?php
//Start session
session_start();
//Include global vars
include('global.php');
//Connect to the DB Server and select the database
cmsdb();
//Get the ID of the user performing the operation
$userid = $_SESSION['SESS_MEMBER_ID'];
//TO DO
//Code the permissions checker
//Function to sanitize values received from the form. Prevents SQL injection
function clean($str) {
$str = @trim($str);
if(get_magic_quotes_gpc()) {
$str = stripslashes($str);
}
return mysql_real_escape_string($str);
}
//Sanitize the POST values
// Echoing them temporarily for debug
echo "member_id ";
echo $member_id = clean($_POST['memact']);
echo "<br />action ";
echo $action = clean($_POST['action']);
//rest of code snipped
What's confusing me is that if the page is outputting that form in [FONT="Courier New"]list-users.php[/FONT] now without issue, why isn't [FONT="Courier New"]exec-user-status.php[/FONT] picking it up right?
No matter which user I click 'disable' next to, it'll come up with the following output on [FONT="Courier New"]exec-user-status.php[/FONT]:
[FONT="Courier New"]member_id 1
action disable[/FONT]
[FONT="Courier New"]member_id 1[/FONT]. every single time. 😕