Location: PHPKode > projects > Gsys > php/view_tshirt.php
<?PHP
//Filename : view_tshirt.php
//Description : View shirt details and allow order
//Author :  Marty
//Last modified :  2006.12.20

    include '../includes/db.php';
    include '../includes/auth.php';
	include('../includes/sql_clean.php');

//pull current user's information from brothers db

    session_start();
    $pin_tmp = $_SESSION['pin_num'];
    $sql = "SELECT pin_num, f_name, l_name FROM brothers WHERE pin_num='$pin_tmp' LIMIT 1";
    $result = mysql_query($sql,$connection) or die(mysql_error());

    $row = mysql_fetch_array($result);
	$l_name = $row['l_name'];
	$f_name = $row['f_name'];
	$pin_num = $row['pin_num'];
	$user = $row['username'];
	
//pull t-shirt chair from the db.

    $sql3 = "SELECT f_name, l_name FROM brothers WHERE auth='tshirts' LIMIT 1";
    $result3 = mysql_query($sql3,$connection) or die(mysql_error());

    $row3 = mysql_fetch_array($result3);
	$tsl_name = $row3['l_name'];
	$tsf_name = $row3['f_name'];
	
//pull design from database to display on page

	$design_id = sql_quote($_GET['cat']);
	$sql2 = "SELECT date_posted, design_by, posted_by, title, description, ordered, image, price FROM tshirts WHERE design_id = '$design_id' LIMIT 1";
	$result2 = mysql_query($sql2,$connection) or die(mysql_error());
	$row2 = mysql_fetch_array($result2);
	$date_posted = $row2['date_posted'];
	$design_by = $row2['design_by'];
	$posted_by = $row2['posted_by'];
	$title = $row2['title'];
	$description = $row2['description'];
	$ordered = $row2['ordered'];
	$image = $row2['image'];
	$price = $row2['price'];
	
?>

<html>
<head>
<title><?php echo "".$title. " Shirt"; ?></title>
<link href="../includes/index.css" rel="stylesheet" type="text/css">
</head>
<body class="body">

<center><strong><?php echo "".$title. " Shirt"; ?></strong></center>
<br /><br />
<center><img src="<?php echo $image;?>"></center>
<br /><br />
<center><?php echo $description;?></center>
<br /><br />
<center><table>
<tr>
<td>
Date Posted: </td><td><?php echo $date_posted;?></td>
</tr>
<tr>
<td>Designed By:</td> <td><?php echo $design_by;?></td>
</tr>
<tr>
<td>
Posted By:</td> <td><?php echo $posted_by;?></td>
</tr>
<tr>
<td>
Price:</td> <td>$<?php echo $price;?> each</td>
</tr>
</table></center>
<p>

<?php if($ordered == 1)
		echo '<center><font color="red"><h2><strong>Sorry but this shirt has already been ordered, please contact '.$tsf_name.' '.$tsl_name.' to see if there are any extras.</strong></h2></font></center>';
else
echo '

<form method="post" action="do_buy_shirt.php">
<input type="hidden" name="added_by" value="'.$_SESSION[current_user].'">
<input type="hidden" name="description" value="'.$title.'">
<input type="hidden" name="price" value="'.$price.'">
<input type="hidden" name="design_id" value="'.$design_id.'">

<br /><br />
Number of shirts to buy:
<SELECT NAME="shirt_number">
<OPTION VALUE="1">1
<OPTION VALUE="2">2
<OPTION VALUE="3">3
<OPTION VALUE="4">4
<OPTION VALUE="5">5
</SELECT>

<br /><br />
Size: (If you require more than one size, please make separate orders)
<SELECT NAME=\"size\">
<OPTION VALUE=\"S\">Small
<OPTION VALUE=\"M\">Medium
<OPTION VALUE=\"L\">Large
<OPTION VALUE=\"XL\">X-Large
<OPTION VALUE=\"XXL\">XX-Large
<OPTION VALUE=\"XXXL\">XXX-Large
</SELECT>
<br /><br />

The account will be charged in the name of: '.$f_name.' '.$l_name.' 
<br /><br />
<strong>Make sure the number of shirts is correct, you will be charged when you click the button below (only click once)</strong>
<br />
<INPUT TYPE="SUBMIT" NAME="submit" VALUE="Charge Shirts">
<br />
</body>
</html>';?>
Return current item: Gsys