im having a problem with php yet again… i’ve created a page with multiple forms on it and when i test it i’ve learnt that the first form is processed (with the ongoing, complete and reject) values but then i cant seem to process the 2nd form the same way. what could be the matter?
any help would be appreciated… happy new year to all the users of the site!
<?
if (array_key_exists('complete',$_POST)) {
echo "Sucess!";
exit;
};
?>
<?php
$days = range (01, 31);
$months = range (1, 12);
$y1 = date("Y")-2;
$y2 = date("Y");
$years = range ($y1, $y2);
if (array_key_exists('caseStatus',$_POST)) {
$case = $_POST['case'];
if ($case == 'complete')
{
echo 'Please set the date on which the case was <b>completed</b>.<p>';
echo "<form action='" . $_SERVER['PHP_SELF'] . "' method='post'>";
echo '<select name="completeDay">';
foreach (range(1, 31) as $day) {
echo '<option value="'.sprintf("%02d", $day).'">'.sprintf("%02d", $day).'</option>';
} echo '</select>';
echo '<select name="completeMon">';
foreach (range(1, 12) as $month) {
echo '<option value="'.sprintf("%02d", $month).'">'.sprintf("%02d", $month).'</option>';
} echo '</select>';
echo '<select name="completeYr">';
foreach ($years as $value) {
echo '<option value="'.$value.'">'.$value.'</option>';
} echo '</select>
<p>
<input type="hidden" name="complete" value="1"/>
<input name="submit" type="submit" value="Save"/>
<input type="button" value="Cancel" onclick="window.location=\'\'"/>
</form>
';
exit;
}
<form method="POST" action="<?php echo $_SERVER['PHP_SELF'] . '?id=' . intval($client_id); ?>">
<select name="case" class="rta">
<option value="<?php echo $row_caseStatus['progress']; ?>" selected="selected"><?php echo $row_caseStatus['progress']; ?></option>
<option value=""></option>
<option value="ongoing">ongoing</option>
<option value="complete">complete</option>
<option value="reject">reject</option>
</select>
<input type="submit" name="caseStatus" id="caseStatus" value="Save" />
<input type="hidden" name="caseStatus" value="1"/>
<br />
</form>
a simple error… just needed to edit the opening php tag!