I'm still learning PHP and I'm trying to insert new values to the database using a dropdown. So far this is what I've made:
<table class="table">
<tr>
<th>Employee Name</th>
<th>Time</th>
<th>Priority</th>
<th>Assignee</th>
<th>Subject</th>
<th>Problem</th>
<th>Status</th>
</tr>
<?php
include ('database.php');
$result = $database->prepare ("SELECT * FROM tickets order by ticketno DESC");
$result ->execute();
for ($count=0; $row_message = $result ->fetch(); $count++){
?>
<tr>
<td><?php echo $row_message['full_name']; ?></td>
<td><?php echo $row_message['time']; ?></td>
<td><?php echo $row_message['priority']; ?></td>
<?php if ($row_message['assignee']) : ?>
<td><?php echo $row_message['assignee']; ?></td>
<?php else : ?>
<td>
<form method="post" action="update1.php">
<input type="hidden" name="ticketno" value="<?php echo $row_message['ticketno']; ?>" />
<input type="submit" name="accept" value="Accept"></input>
</form>
</td>
<?php endif ; ?>
<td><?php echo $row_message['subject']; ?></td>
<td><?php echo $row_message['problem']; ?></td>
<td>
<label for=""></label> <select style="font-family: Questrial;" name="status" required>
<option disabled selected hidden>Select Status</option>
<option name="status" value="In Progress">In Progress</option>
<option name="status" value="Closed: Cancelled">Closed: Cancelled</option>
<option name="status" value="Closed: Solved">Closed: Solved</option>
</select>
</td>
</tr>
<?php } ?>
</table>
I also got a sample script:
<script>
$(document).ready(function(){
$('input[type="radio"]').click(function(){
var gender = $(this).val();
$.ajax({
url:"insert.php",
method:"POST",
data:{gender:gender},
success: function(data){
$('#result').html(data);
}
});
});
});
</script>
My concern is, I'm not sure what should be my ('input[type="radio"]')
if I'm using a dropdown.
Here's my table schema:
Table Schema