RE: [?] How to make many one line forms in a loop?
| From: | Brinkman, Theodore | Date: | Thu, 15 Mar 2001 02:28:24 +0000 |
| Subject: | RE: [?] How to make many one line forms in a loop? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-43952@lists.php.net to get a copy of this message | ||
Try it this way instead (my apologies for any typos, I'm getting ready to
leave work and didn't bother to test it, but it should get the concept
across).
- - - - -
<?php
error_reporting(E_ALL);
include("/home/httpd/php/open_db.inc");
// default setting for $sort_term
if ($sort_term == null)
{
$sort_term = "lid";
}
$sql = "SELECT lid, remote_addr, php_self, uid, event_time FROM website_log
ORDER BY $sort_term ASC";
$result = mysql_query($sql, $db);
$rows = mysql_num_rows($result);
?>
<center>
<b><u>Log File Dump</u></b>
<br>
<br>
<table bgcolor=#000000>
<tr>
<td bgcolor=#000000>
<table cellpadding=4 cellspacing=0 bgcolor=#ffffff>
<tr>
<th>
<a href="<?php echo $PHP_SELF;?>?sort_term=lid">Log
ID#</a>
</th>
<th>
<a href="<?php echo $PHP_SELF;?>?sort_term=remote_addr">Remote
Address</a>
</th>
<th>
<a href="<?php echo $PHP_SELF;?>?sort_term=php_self">File
Accessed</a>
</th>
<th>
<a href="<?php echo $PHP_SELF;?>?sort_term=uid">Accessed
By</a>
</th>
<th>
<a href="<?php echo $PHP_SELF;?>?sort_term=event_time">On this
Date</a>
</th>
</tr>
<?php
while ($row = mysql_fetch_array($result))
{
$log_id = $row["lid"];
$remote_address = $row["remote_addr"];
$file_id = $row["php_self"];
$user_id = $row["uid"];
$time_of_event = $row["event_time"];
?>
<tr>
<td>
<form name="log_id_search" action="<?php echo
$PHP_SELF;?>"
method="POST">
<input type="hidden" name="sql_search_type"
value="log_id"/>
<input type=hidden name="search_key" value="<?php echo
$log_id;?>"/>
<input type="submit" name="search_this" value="<?php
echo
$log_id;?>"/>
</form>
</td>
<td>
<?php echo $remote_address;?>
</td>
<td>
<?php echo $file_id;?>
</td>
<td>
<?php echo $user_id;?>
</td>
<td>
<?php echo $time_of_event;?>
</td>
</tr>
<?php
}
mysql_free_result($result);
mysql_close($db);
?>
</table>
</td>
</tr>
</table>
</center>
- - - - -