[?] How to make many one line forms in a loop?

From: Date: Wed, 14 Mar 2001 18:23:03 +0000
Subject: [?] How to make many one line forms in a loop?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-43890@lists.php.net to get a copy of this message
Howdy Folks! I am wondering how to make a giant list of forms in a loop. My goal is to search the database for the data in the cell clicked. This is step by step process that I would like to achieve: 1. Dump the contents of the website_log db to the browser in a table format. 2. User clicks on any cell in the table. 3. A new sql query is submitted to mysql based on the data in that cell. 4. The sql results are redisplayed in table format in the browser. Presently, here's what I have: I have a mysql db filled with access logs - things like HTTP_REFERER, etc. Presently, I dump them out to the browser like this: <?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); echo "<center><b><u>Log File Dump</u></b><br><Br>"; echo "<table bgcolor=#000000> <tr> <td bgcolor=#000000><table cellpadding=4 cellspacing=0 bgcolor=#ffffff>"; echo "<tr> <th><a href='$PHP_SELF?sort_term=lid'>Log ID#</a></th> <th><a href='$PHP_SELF?sort_term=remote_addr'>Remote Address</a></th> <th><a href='$PHP_SELF?sort_term=php_self'>File Accessed</a></th> <th><a href='$PHP_SELF?sort_term=uid'>Accessed By</a></th> <th><a href='$PHP_SELF?sort_term=event_time'>On this Date</a></th> </tr>"; 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"]; echo "<tr> <td>$log_id</td> <td>$remote_address</td> <td>$file_id</td> <td>$user_id</td> <td>$time_of_event</td> </tr>"; } echo "</table></td></tr></table>"; echo "</center>"; mysql_free_result($result); mysql_close($db); ?> What I would like to do is convert the echo statement in the while loop into something like this: echo "<tr> <td> <FORM NAME="log_id_search" ACTION="$PHP_SELF" METHOD=POST> <INPUT TYPE=HIDDEN NAME="sql_search_type" VALUE="log_id"> <INPUT TYPE=HIDDEN NAME="search_key" VALUE="$log_id"> <INPUT TYPE=SUBMIT NAME="search_this" VALUE="$log_id"> </FORM> </td> <td>$remote_address</td> <td>$file_id</td> <td>$user_id</td> <td>$time_of_event</td> </tr>"; I've tried the above modification but PHP silently barfs on it. Would anyone have any insights or suggestions? Thanks in advance! John -- /====================================================================\ | John Voth Mobiltex Data Ltd.Calgary, Alberta,Canada, T1Y-4T7 | | jvoth@mobiltex.com 403-291-2770, 403-259-6795 (fax) | \====================================================================/

« previous php.general (#43890) next »