I have an initial form with a single input and a submit. The options are gotten from a DB column 'clinics'. The user selects a clinic and submits by hitting NEXT.
- The submitted
$_POST
value goes into the variable$clinic
, - The
$clinic
variable is used to query the DB and get the$clinic_hours
variable. - The user is then redirected to a new form with a text input prefilled with the
$clinic
value and with a label that says "clinic: General Hospital available hours: 7.4", which is$clinic
and$clinic_hours
. - The user fills the rest of the form and submits, but this causes the 2 variables to become undefined, and the form cannot be submitted. Does anyone know how to retain the
$_POST
values so I can submit them in a form?
This is my code:
form 1:
<form action="session.php" method="POST">
<select id="clinic" name="session_clinic">
<?php
while ( $row = mysqli_fetch_assoc($get_org_query) )
{
echo '<option
value="'.$row['name'].'">'.$row['name'].'</option>';
}
?>
</select>
<input type="submit" id="clinic_submit"
name="clinic_submit" value="Next">
</form>
form 2:
<form action="session.php" method="POST">
<label for="session_clinic" class="clinic_label">Clinic: <?php echo
$clinic ?> (Available: <?php echo $clinic_hours ?> hours)</label>
<br>
<input type="text" id="session_clinic"
class="session_clinic" name="session_clinic" value="<?php
echo $clinic ?>">
<input type="date" name="session_date">
<input type="text" id="session_duration"
class="duration" name="session_duration">
<textarea name="session_note" id="session_note" cols="56" rows="7"></textarea>
<input type="radio" name="status" value="Billable"> Billable<br>
<input type="radio" name="status" value="Not Billable"> Not Billable<br>
<input type="submit" name="session_submit" value="Submit">
</form>