<?php
$db_name = "time2scr_t2sgallery";
$table_name = "gallery";
$type = $_POST[enter_data];
$connection = mysql_connect('server', 'userid', 'password') or die(mysql_error());
// get the database list
$dbs = mysql_select_db ($db_name, $connection) or die(mysql_error());
$sql = "SELECT * FROM $table_name WHERE gallery_type='$type'";
$results = mysql_query($sql, $connection) or die(mysql_error());
// read the database
while ($row = mysql_fetch_array($results)) {
$id =$row[id];
$picture_url = $row[picture_url];
$su
pplies_list = $row[supplies_list];
$how_to =
$row[how_to];
$gallery_type = $row[gallery_type];
$type_title =$row[type_title];
$picture_title = $row[picture_title];
$lrg_pix_url =$row[lrg_pix_url];
$alt = $row[alt];
$product_link = $row[product_link];
// Count the instances of a gallery type
$count = $count + 1;
if ($supplies_list != "") {
$supplies_list_title = "$picture_title Supplies";
} else {
$supplies_list_title = "";
}
if ($how_to != "") {
$button = "<input type=\"submit\" name=\"submit\" value=\"How To...\" />";
} else {
$button = "";
}
$display_table .=
" <!-- //////////////////////// ROW 1 - Title bar /////////////////////////////// -->
<tr>
<td align=\"left\"><p class=\"normal\">$picture_title</p></td>
<td align=\"left\"><p class=\"normal\">$supplies_list_title</p></td>
</tr>
<!-- //////////////////////// ROW 2 - Large Picture block ///////////////////////// -->
<tr>
<td> <!-- ********************** Cell containing picture ************************ -->
<form action=\"large.php\" method=\"POST\" target=\"_blank\">
<input type=\"hidden\" name=\"lrg_pix_url\" value=\"$lrg_pix_url\" />
<input type=\"hidden\" name=\"alt\" value=\"$alt\" />
<input type=\"image\" src=\"$picture_url\" name=\"image\" />
</form>
</td>
<td valign=\"top\"> <!-- ****************** Cell containing list of supplies ************* -->
$supplies_list
</td>
</tr>
<!-- //////////////////////// ROW 3 - How To Block //////////////////////////////// -->
<tr>
<td> </td> <!-- ***************** spacer cell ********************* -->
<td align=\"center\"> <!-- ************** Cell containing how_to form *************** -->
<form method=\"POST\" action=\"how_to.php\" target=\"_blank\" />
<input type=\"hidden\" name=\"how_to\" value=\"$how_to\" />
<input type=\"hidden\" name=\"title\" value=\"$picture_title\" />
<input type=\"hidden\" name=\"product_link\" value=\"$product_link\" />
$button
</form>
</td>
</tr>
<!-- //////////////////////// ROW 4 - spacer /////////////////////////////////////// -->
<tr>
<td> </td>
<td> </td>
</tr>
<!-- **************************** new product ************************************ -->
\n";
}
$start_table = "<table border=\"0\">\n";
$end_table = "</table>\n";
mysql_close($connection);
?>