I'm new to php. I am developing a form with the following code:
<td>Severity:</td>
<td>
<?php $dbc = mysql_connect('localhost', 'root', ''); // root connection
mysql_select_db('ticket', $dbc); // db selection
$query = "SELECT id, severity FROM severity" ; // retrieving value from table severity in db
$result = mysql_query($query, $dbc); //
echo'<select name="sever">';
echo '<option value="Default"> Please Select Severity </option>';
while($row = mysql_fetch_assoc( $result ))
{
echo '<option value="'.$row['id'].'">' . $row['severity'] . '</option>';
}
echo '</select>';
?>
</td>
In the database i have created 3 severity levels with values as follows:
Table Severity (ID, Severity, Hours) values (1, 'Critical', '12'), (2, 'Major', '24'),(3, 'Minor', '36');
And i have a date function in the form
<td> Expected Completed Date: </td>
<td> <input name="exc_date" style="width:150px" type="text" /> </td>
As soon as i select severity i want the expected completed date to be auto generated based on the selection of severity.
I am bit ambiguous as to how i need to generate the php code in the form for Expected Completed Date.
Kindly do help me and thanks in advance for your suggestions.