I wonder how i could send two primary keys with my POST? So far i can only figure out how i can send one. This is how i get one with my button value='$id'
And now i need my $key also so i can update my sql.
Do i need to do it in a array? or make a string with them two together?
My db
while((db2_fetch_row($queryexe)) and ($counter < $max)) {
$key = db2_result($queryexe, 'PKEY');
$id = db2_result($queryexe, 'PID');
$akt = db2_result($queryexe, 'AKT');
Tables + my button
print("<td>$key</td>
");
print("<td class='center'>$id</td>
");
print("<td><form class='form-horizontal' method='post'><button name = 'test'
type='submit' id = 'test' value='$id' class='btn btn-default'>
<i class='glyphicon glyphicon-repeat'></i> Klar
</button></form></td>
");
And my button
if(isset($_POST['test'])) {
$dbhost = '***';
$dbuser = '***';
$dbpass = '***';
$conn = db2_connect($dbhost, $dbuser, $dbpass);
if(! $conn ) {
die('Could not connect: ');
}
$sql = "UPDATE MYDB SET AKT = 'X'
WHERE PKEY = '$key' AND PID = $id ";
$retval = db2_exec( $conn, $sql);
if(! $retval ) {
die('Could not update data: ' . db2_stmt_errormsg());
}
echo "Updated data successfully
";
db2_close($conn);
}
}