What adjustments can be made to the printTicketType function to display a table instead of a select box?
To display a table instead of a select box in the printTicketType function, we need to modify the HTML output generated by the function. We can create a table with rows and columns to display the ticket types along with their details. Each row in the table will represent a ticket type with its corresponding information.
function printTicketType() {
// Retrieve ticket types from the database or any data source
$ticketTypes = array(
array('name' => 'General Admission', 'price' => '$20'),
array('name' => 'VIP', 'price' => '$50'),
array('name' => 'Student', 'price' => '$15')
);
echo '<table>';
echo '<tr><th>Ticket Type</th><th>Price</th></tr>';
foreach ($ticketTypes as $ticket) {
echo '<tr>';
echo '<td>' . $ticket['name'] . '</td>';
echo '<td>' . $ticket['price'] . '</td>';
echo '</tr>';
}
echo '</table>';
}
// Call the function to display ticket types in a table format
printTicketType();