Welcome Guest, Not a member yet? Register   Sign In
Display results in a table
#2

On your VIEW options_view.php page

PHP Code:
<!DOCTYPE html>
<
html lang="en">
<
head>
    <
meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <
title>Untitled</title>
    <
style type="text/css" media="screen">
        
label{display:block;}
    </
style>
</
head>
<
body>
<
h2>Create</h2>
<?
php echo form_open('site/create');?>
<p>
<label for="title">Title:</label>
<input type="text" name="title" id="title" />
</p>
<p>
<label for="content">Content:</label>
<input type="text" name="content" id="content" />
</p>
<p>    
    <input type="submit" value="submit" />    
</p>
<?php echo form_close(); ?>
<hr />
<h2>Read</h2>
<table class="table">
    <thead>
      <tr>
        <th>Title</th>
        <th>Content</th>
      </tr>
    </thead>
    <tbody>
    <?php if(isset($records)) : foreach($records as $row) : ?>
      <tr>
        <td><?php echo anchor("site/delete/$row->Id"$row->title); ?> </td>
        <td><?php echo $row->content?></td>
      </tr>
     <?php endforeach; ?>
     <?php else : ?>
    <tr>
        <td><h2>No records returned.</h2></td>
    </tr>
    <?php endif; ?>
    <tr>
        <td><h2>Delete</h2></td>
    </tr>
  </table>
<hr />
<h2></h2>
<p>To sample the delete method, click on on of the headings above.
A delete query will automatically run.
</p>
</body>
</html> 
Web Developer
Reply


Messages In This Thread
Display results in a table - by ozzy - 06-20-2017, 12:41 PM
RE: Display results in a table - by Php - 06-20-2017, 09:00 PM
RE: Display results in a table - by Paradinight - 06-20-2017, 09:34 PM
RE: Display results in a table - by rtenny - 06-21-2017, 02:41 AM
RE: Display results in a table - by Paradinight - 06-21-2017, 11:34 AM



Theme © iAndrew 2016 - Forum software by © MyBB