I would like to send 2 variables on a click of a button My Code so far is that:
HTML:
<?php
while ($Case=mysql_fetch_assoc($records)) {
echo "<tr>";
echo "<td>".$Case['SubmissionID']."</td>";
echo "<td>".$Case['AppID']."</td>";
echo "<td>".getFullNameApp($Case['AppID'])."</td>";
echo "<td>".getCourseName($Case['SubmissionCourseID'])."</td>";
echo "<td>".getDepartmentName($Case['SubmissionCourseID'])."</td>";
echo "<td>".DateFormat($Case['Date'])."</td>";
echo "<td>".$Case['SubmissionStatus']."</td>";
if ($Case['SubmissionStatus'] == 'Draft') {
echo "<form action='ApplicantApplyDetails.php' method='POST'>";
echo "<td><button type='submit' class='btn btn-success btn-xs' name='modifybtn' value='".array($Case['SubmissionID'], $Case['SubmissionCourseID'])."'>Modify</button></td>";
}
else {
echo "<td><button type='submit' class='btn btn-danger btn-xs disabled' disabled='disabled' name='modifybtndis' value=''>Modify</button></td>";
}
echo "</form>";
echo "</tr>";
}
mysql_close();
?>
PHP:
if (isset($_POST['modifybtn'])) {
$SubmissionID =$_POST['modifybtn'][0];
$CourseID = $_POST['modifybtn'][1];
echo $CourseID;
}
And then get those variables for further processing. Is that possible? I've done single ones but no arrays. My code is not working. The problem I think is in the HTML part, but I have no idea how to fix it. Any hints?
var_dump($_POST['modifybtn'])looks like? start from there, or just follow Xorifelse answer.