Forum Moderators: coopster
<form>
<INPUT TYPE=BUTTON VALUE="SUBMIT LOG" style="font-size:10px;"
OnClick="window.location.href='http://www.example.com/trip_log/trip_log_selection.php'">
</form>
<TABLE class="tripSelect" cellspacing="1" border="1" id="table1" width="500">
<TR class="tripSelectHeader c4">
<TD width="70" align="center">
<font class="tinytextblk" face="Arial" size="1">Trip Type</font>
</TD>
<TD width="125" align="center">
<font class="tinytextblk" face="Arial" size="1">Trip Location</font>
</TD>
<TD width="25" align="center">
<font class="tinytextblk" face="Arial" size="1">State</font>
</TD>
<TD width="65" align="center">
<font class="tinytextblk" face="Arial" size="1">Date</font>
</TD>
<TD width="30" align="center">
<font class="tinytextblk" face="Arial" size="1">Miles</font>
</TD>
<TD width="37" align="center">
<font class="tinytextblk" face="Arial" size="1">View</font>
</TD>
<TD width="37" align="center">
<font class="tinytextblk" face="Arial" size="1">View</font>
</TD>
<TD width="37" align="center">
<font class="tinytextblk" face="Arial" size="1">View</font>
</TD>
</TR>
{triplog}
</TABLE>
Here is the {triplog} tag code:
$host = "localhost";
$user = "user";
$pass = "pass";
$dbname = "dbname";
$connection = mysql_connect($host,$user,$pass) or die (mysql_errno().": ".mysql_error()."<BR>");
mysql_select_db($dbname);
$sql = 'SELECT * FROM trip_log ORDER BY startdate, enddate asc';
$result = mysql_query($sql) or die ('<p>select died: ' . mysql_error());
while ($row = mysql_fetch_array($result)) {
$startdate = date("F d, Y",$row['startdate']);
$enddate = date("F d, Y",$row['enddate']);
echo '<TR class="tripSelectRow">';
echo '<TD width="70" align="center">';
echo '<font class="tinytextblk" face="Arial" size="1">',$row['triptype'],'</font>';
echo '</TD>';
echo '<TD width="125" align="center">';
echo '<font class="tinytextblk" face="Arial" size="1">',$row['triplocation'],'</font>';
echo '</TD>';
echo '<TD width="25" align="center">';
echo '<font class="tinytextblk" face="Arial" size="1">',$row['state'],'</font>';
echo '</TD>';
echo '<TD width="65" align="center">';
echo '<font class="tinytextblk" face="Arial" size="1">';
echo $startdate; if ($enddate!= $startdate) echo ' to ',$enddate;
echo '</font>';
echo '</TD>';
echo '<TD width="30" align="center">';
echo '<font class="tinytextblk" face="Arial" size="1">';
if (!empty($row['miles'])) echo $row['miles'];
else echo ' ';
echo '</font>';
echo '</TD>';
echo '<TD width="37" align="center">';
echo '<font class="tinytextblk" face="Arial" size="1">';
if (!empty($row['report'])) echo '<a href="/trip_log/trip_log_report.php?trip=',$row['trip_id'],'">Report</a>';
else echo ' ';
echo '</font>';
echo '</TD>';
echo '<TD align="Center" width="37">';
echo '<font class="tinytextblk" face="Arial" size="1">';
if (!empty($row['photolink'])) echo '<A HREF="javascript:void(0);" onclick="fullScreen(\'',$row['photolink'],'\');">Photos</A>';
else echo ' ';
echo '</font>';
echo '</TD>';
echo '<TD width="37" align="center">';
echo '<font class="tinytextblk" face="Arial" size="1">';
if (!empty($row['videolink'])) echo '<A HREF="javascript:void(0);" onclick="fullScreen(\'',$row['videolink'],'\');">Videos</A>';
else echo ' ';
echo '</font>';
echo '</TD>';
echo '</TR>';
}
[edited by: coopster at 3:52 pm (utc) on Jan. 6, 2006]
[edit reason] generalized url [/edit]
<?php
echo "<form>\n";
echo "<INPUT TYPE=BUTTON VALUE=\"SUBMIT LOG\" style=\"font-size:10px;\"\n";
echo "OnClick=\"window.location.href='http://www.example.com/trip_log/trip_log_selection.php'\">\n";
echo "</form>\n";
echo "\n";
echo "<TABLE class=\"tripSelect\" cellspacing=\"1\" border=\"1\" id=\"table1\" width=\"500\">\n";
echo "<TR class=\"tripSelectHeader c4\">\n";
echo "<TD width=\"70\" align=\"center\">\n";
echo "<font class=\"tinytextblk\" face=\"Arial\" size=\"1\">Trip Type</font>\n";
echo "</TD>\n";
echo "<TD width=\"125\" align=\"center\">\n";
echo "<font class=\"tinytextblk\" face=\"Arial\" size=\"1\">Trip Location</font>\n";
echo "</TD>\n";
echo "<TD width=\"25\" align=\"center\">\n";
echo "<font class=\"tinytextblk\" face=\"Arial\" size=\"1\">State</font>\n";
echo "</TD>\n";
echo "<TD width=\"65\" align=\"center\">\n";
echo "<font class=\"tinytextblk\" face=\"Arial\" size=\"1\">Date</font>\n";
echo "</TD>\n";
echo "<TD width=\"30\" align=\"center\">\n";
echo "<font class=\"tinytextblk\" face=\"Arial\" size=\"1\">Miles</font>\n";
echo "</TD>\n";
echo "<TD width=\"37\" align=\"center\">\n";
echo "<font class=\"tinytextblk\" face=\"Arial\" size=\"1\">View</font>\n";
echo "</TD>\n";
echo "<TD width=\"37\" align=\"center\">\n";
echo "<font class=\"tinytextblk\" face=\"Arial\" size=\"1\">View</font>\n";
echo "</TD>\n";
echo "<TD width=\"37\" align=\"center\">\n";
echo "<font class=\"tinytextblk\" face=\"Arial\" size=\"1\">View</font>\n";
echo "</TD>\n";
echo "</TR>\n";
echo "{triplog}\n";
echo "</TABLE>\n";
?>
You can copy-paste that, it should work but watch the <?php and?> tags.
I love code debugs :-)
[edited by: topsites at 5:34 am (utc) on Jan. 6, 2006]
[edited by: coopster at 3:53 pm (utc) on Jan. 6, 2006]
[edit reason] generalized url (carried over from OP) [/edit]