asked on
ASKER
ASKER
PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.
TRUSTED BY
ASKER
Here's the code for the entire thing.
<form action="process_table.php"
<table>
<tr>
<th scope="col">Date</th>
<th scope="col">Amount</th>
<th scope="col">Vendor</th>
<th scope="col">Description</t
<th scope="col">Type</th>
<th scope="col">Notes</th>
<th scope="col">Trip</th>
<th scope="col">Last Updated</th>
<th scope="col">Last Updated By</th>
<th scope="col">Done</th>
</tr>
<?php
$get_transactions = "SELECT * FROM transactions order by date ASC LIMIT 10";
$transactions_result_set = mysqli_query($connection, $get_transactions);
$get_types = "SELECT * FROM type";
$type_result_set = mysqli_query($connection, $get_types);
?>
<?php // this section creates the entire table
//the line below creates each record and puts it in a table
?>
<?php
//this opens the tag
$type = "<select>";
//this while statement turns each entry from the database into value
while ($row = mysqli_fetch_assoc($type_r
//this statement appends to the existing variable
$type .= sprintf("<option value='%s'>%s</option>", $row["type_name"], $row["type_name"]);
}
$type .= "</select>";
?>
<?php while ($expenses = mysqli_fetch_assoc($transa
?>
<tr>
<td><?php echo date("F d, Y", strtotime($expenses["date"
<td><?php echo number_format($expenses["a
<td><?php echo $expenses["vendor"];?></td
<td><?php echo $expenses["description"];?
<td><?php echo $type; ?></td>
<td><textarea name="notes" id="notes"></textarea></td
<td nowrap="nowrap">Trip place holder</td>
<td><?php echo date("m/d/Y")?></td>
<td>User Name</td>
<!-- <td><?php// date("F d, Y");?></td>-->
<td><input name="done" type="checkbox" id="done"></td>
</tr>
<?php
}
?>
</table>
<input type="submit">
</form>