I will like to get multiple request after clicking submit. Meaning that after i clicked submit and get the result, i will like to inquire results again and click submit again. I don't want to lead myself back to nothingness.
<?php
error_reporting(0);
if (!$_POST['submit'])
{
<form action="http://localhost/test.php" method="post">
Type of Leave:
<select name="leave">
<option value=""selected="selected"></option>
<option VALUE="Medical Leave"> Medical Leave</option>
<option VALUE="Unpaid Leave"> Unpaid Leave</option>
</select>
<input type="submit" name="submit" value="Check!" />
</form>
<?php
}
else
{
$conn=odbc_connect("employee","","") or die (odbc_errormsg());
if (!$conn)
{
exit
("Connection Failed: " . $conn);
}
else
{
$choice = $_POST['leave'];
$sql="SELECT * FROM balance WHERE ID=$username";
$rs=odbc_exec($conn,$sql);
?>
<?php
while (odbc_fetch_row($rs))
{
$choice=odbc_result($rs,"$choice");
echo "<tr><td>$choice</td>";
}
odbc_close($conn);
echo "</table>";
}
}
Currently the code itself queries out the expected output that I want, but the only downside is it stays there as an output. What my aim is to have the submit and the select choice option stays there so that I can continue to output the result I want, thanks.