Skip to content

Commit

Permalink
Update index.php
Browse files Browse the repository at this point in the history
  • Loading branch information
milq authored May 17, 2017
1 parent dee4636 commit bca669a
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions learn/crud/xml/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
</head>

<body>
<h1>Students</h1>
<a href='form.php'>Insert a new student</a><br /><br />
<h1>Students</h1>

<a href='form.php'>Insert a new student</a><br /><br />

<?php

require_once('load_xml.php');

echo '<table>';
echo '<tbody>';
echo "<table title='student_table'>";
echo '<thead>';
echo '<tr>';
echo '<th>ID</th>';
echo '<th>First name</th>';
Expand All @@ -28,21 +28,23 @@
echo '<th>Edit</th>';
echo '<th>Delete</th>';
echo '</tr>';
echo '</tbody>';
echo '</thead>';
echo '<tbody>';

foreach($xml->children() as $student) {
echo '<tr>';
foreach($xml->children() as $student) {
echo '<tr>';
echo '<td>' . $student['id'] . '</td>';
echo '<td>' . $student->first_name . '</td>';
echo '<td>' . $student->last_name . '</td>';
echo '<td>' . $student->nickname . '</td>';
echo '<td>' . $student->date_of_birth . '</td>';
echo '<td>' . $student->mark . '</td>';
echo '<td><a title=\'edit_' . $student['id'] . '\' href=\'form.php?id=' . $student['id'] . '\'>Edit</a></td>';
echo '<td><a title=\'delete_' . $student['id'] . '\' href=\'process.php?delete=yes&id=' . $student['id'] . '\'>Delete</a></td>';
echo "<td><a title='edit_" . $student['id'] . "' href='form.php?id=" . $student['id'] . "'>Edit</a></td>";
echo "<td><a title='delete_" . $student['id'] . "' href='process.php?delete=yes&id=" . $student['id'] . "'>Delete</a></td>";
echo '</tr>';
}

echo '</tbody>';
echo '</table>';
?>
</body>
Expand Down

0 comments on commit bca669a

Please sign in to comment.