FORUMS


The Form Tools forums are no longer active, but the old posts have been archived here. Please see the Help page on how to get help / report issues.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using GET to display five specific entries on my website
#2
So here is what I have figured out so far. I set up the form with formtools. I created an additional field that is a checkbox. The checkbox is not on the form, just editable from the backend when editing the results in formtools.

I then created a php page with the following attached code. Basically it says that if a certain field is equal to "1" (the checkbox), then show the data. (In other words, when the checkbox is checked, the data appears on the below page) The problem is, I'd like it to display each set of data in a different html table.. not as another row in the table.

Any ideas?

PHP Code:
<html>
<
body>
<?
php
$username
="USERNAME";
$password="PASSWORD";
$database="DATABASE";

mysql_connect(localhost,$username,$password);
@
mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM ft_form_12 WHERE col_24='1'";
// $query="SELECT * FROM ft_form_12";
// SELECT * FROM ft_form_12 WHERE col_24='1'
$result=mysql_query($query);

$num=mysql_numrows($result);

mysql_close();
?>
<table border="0" cellspacing="2" cellpadding="2">
<tr>
<th><font face="Arial, Helvetica, sans-serif">Value1</font></th>
<th><font face="Arial, Helvetica, sans-serif">Value2</font></th>
<th><font face="Arial, Helvetica, sans-serif">Value3</font></th>
<th><font face="Arial, Helvetica, sans-serif">Value4</font></th>
<th><font face="Arial, Helvetica, sans-serif">Value5</font></th>
</tr>

<?php
$i
=0;
while (
$i $num) {

$f1=mysql_result($result,$i,"col_1");
$f2=mysql_result($result,$i,"col_2");
$f3=mysql_result($result,$i,"col_3");
$f4=mysql_result($result,$i,"col_4");
$f5=mysql_result($result,$i,"col_5");
?>

<tr>
<td><font face="Arial, Helvetica, sans-serif"><?php echo $f1?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><?php echo $f2?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><?php echo $f3?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><?php echo $f4?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><?php echo $f5?></font></td>
</tr>

<?php
$i
++;
}
?>
</table>
</body>
</html> 
Reply


Messages In This Thread
RE: Using GET to display five specific entries on my website - by alexh - May 12th, 2011, 12:30 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)