dragon2309
P.I Dragon
damn semi colons, i always forget those, so yeh, form is inside the PHP block and its being echoed to be displayed on the page. NOTE: it doesnt actually work anymore though, it comes up with 404
code is:
code is:
PHP:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>price Query</title>
</head>
<link rel="stylesheet" href="../menu.css">
<body>
</head>
<body>
<form>
<p align="center">
<img border="0" src="../logo%202%20better.jpg" width="640" height="150"><script language="JavaScript" src="menu.js"></script><script language="JavaScript" src="menu_items.js"></script><script language="JavaScript" src="menu_tpl.js"></script><script language="JavaScript">
<!--//
new menu (MENU_ITEMS, MENU_POS, MENU_STYLES);
//-->
</script></p>
<p align="right"><b><font face="Tahoma"><a href="javascript:history.back()"><--
Back</a></font></b></p>
</form>
<br>
<?php
echo"<form id='make_select' action='<?php $PHP_SELF; ?>' method='post'>
<p>
Select price:
<select name='price'>
<option value='£1.99'>£1.99</option>
<option value='£2.99'>£2.99</option>
<option value='£3.99'>£3.99</option>
<option value='£4.99'>£4.99</option>
<option value='£5.99'>£5.99</option>
<option value='£6.99'>£6.99</option>
<option value='£7.99'>£7.99</option>
<option value='£8.99'>£8.99</option>
<option value='ALL'>All Price Options</option>
</select>
Select category:
<select name='cat'>
<option value='ad_brac'>Adult Bracelets</option>
<option value='ch_brac'>Child Bracelets</option>
<option value='charm_brac'>Charm Bracelets</option>
<option value='ad_neck'>Adult Necklaces</option>
<option value='ch_neck'>Child Necklaces</option>
<option value='ad_set'>Adult Sets</option>
<option value='ch_set'>Child Sets</option>
<option value='earring'>Earrings</option>
<option value='k_pin'>Kilt Pins</option>
<option value='l_pin'>Lapel Pins</option>
<option value='wine_ch'>Wine Charms</option>
<option value='bag_ch'>Bag Charms</option>
<option value='bookmark'>Bookmarks</option>
</select>
<input type='submit' />
</p>
</form>";
if( ! empty( $_POST["price"] ) )
if( ! empty( $_POST["cat"] ) )
{
echo"<font face='Tahoma' style='font-size: 11pt'>You have selected to view all </font>";
if($cat == 'ad_brac')
echo "<font face='Tahoma' style='font-size: 11pt'><b><u>Adult Bracelets</u></b></font>";
if($cat == 'ch_brac')
echo "<font face='Tahoma' style='font-size: 11pt'><b><u>Child Bracelets</u></b></font>";
if($cat == 'ad_neck')
echo "<font face='Tahoma' style='font-size: 11pt'><b><u>Adult Necklaces</u></b></font>";
if($cat == 'ch_neck')
echo "<font face='Tahoma' style='font-size: 11pt'><b><u>Child Necklaces</u></b></font>";
if($cat == 'ad_set')
echo "<font face='Tahoma' style='font-size: 11pt'><b><u>Adult Sets</u></b></font>"; // This is all the IF statements
if($cat == 'ch_set') // for the top section
echo "<font face='Tahoma' style='font-size: 11pt'><b><u>Child Sets</u></b></font>"; // This displays what the user
if($cat == 'bag_ch') // has actaully searched for,
echo "<font face='Tahoma' style='font-size: 11pt'><b><u>Bag Charms</u></b></font>";
if($cat == 'wine_ch')
echo "<font face='Tahoma' style='font-size: 11pt'><b><u>Wine Charms</u></b></font>";
if($cat == 'l_pin')
echo "<font face='Tahoma' style='font-size: 11pt'><b><u>Lapel Pins</u></b></font>";
if($cat == 'k_pin')
echo "<font face='Tahoma' style='font-size: 11pt'><b><u>Kilt Pins</u></b></font>";
if($cat == 'earring')
echo "<font face='Tahoma' style='font-size: 11pt'><b><u>Earrings</u></b></font>";
if($cat == 'charm_brac')
echo "<font face='Tahoma' style='font-size: 11pt'><b><u>Charm Bracelets</u></b></font>";
if($cat == 'bookmark')
echo "<font face='Tahoma' style='font-size: 11pt'><b><u>Bookmarks</u></b></font>";
print"<font face='Tahoma' style='font-size: 11pt'> at </font>";
if($price == '£1.99')
echo "<font face='Tahoma' style='font-size: 11pt'><b><u>£1.99</u></b><br><br><br></font>";
if($price == '£2.99')
echo "<font face='Tahoma' style='font-size: 11pt'><b><u>£2.99</u></b><br><br><br></font>";
if($price == '£3.99')
echo "<font face='Tahoma' style='font-size: 11pt'><b><u>£3.99</u></b><br><br><br></font>";
if($price == '£4.99')
echo "<font face='Tahoma' style='font-size: 11pt'><b><u>£4.99</u></b><br><br><br></font>";
if($price == '£5.99')
echo "<font face='Tahoma' style='font-size: 11pt'><b><u>£5.99</u></b><br><br><br></font>";
if($price == '£6.99')
echo "<font face='Tahoma' style='font-size: 11pt'><b><u>£6.99</u></b><br><br><br></font>";
if($price == '£7.99')
echo "<font face='Tahoma' style='font-size: 11pt'><b><u>£7.99</u></b><br><br><br></font>";
if($price == '£8.99')
echo "<font face='Tahoma' style='font-size: 11pt'><b><u>£8.99</u></b><br><br><br></font>";
echo '<table border="1" div align="center" bgcolor="#FFD9FF" bordercolor="#FF9DFF" bordercolorlight="#FF9DFF" bordercolordark="#FF9DFF" cellpadding="6" style="border-collapse: collapse; font-family: Tahoma; font-size: 11pt">
<tr>
<th><font face="Tahoma">Item Number</font></th>
<th><font face="Tahoma">Description</font></th>
<th><font face="Tahoma">Price</font></th>
<th><font face="Tahoma">Image</font></th>
<th><font face="Tahoma">Information</font></th>
<th bgcolor="#FFECFF"> </th>
<th>Item Number</th>
<th>Description</th>
<th>Price</th>
<th>Image</th>
<th>Information</th>
</tr>
<tr>
<td bgcolor="#FFECFF"> </td>
<th bgcolor="#FFECFF"> </th>
<th bgcolor="#FFECFF"> </th>
<th bgcolor="#FFECFF"> </th>
<th bgcolor="#FFECFF"> </th>
<th bgcolor="#FFECFF"> </th>
<th bgcolor="#FFECFF"> </th>
<th bgcolor="#FFECFF"> </th>
<th bgcolor="#FFECFF"> </th>
<th bgcolor="#FFECFF"> </th>
<th bgcolor="#FFECFF"> </th>
</tr>';
require "dbinfo.php";
// Connect to MySQL DBMS
if (!($connection = @ mysql_connect(DB_HOSTNAME, DB_USERNAME, DB_PASSWORD)))
showerror();
// Use the cars database
if (!mysql_select_db(DB_DATABASENAME, $connection))
showerror();
// Create SQL statement
$cat = $_POST["cat"];
$price = $_POST["price"];
if ($price == 'ALL')
$query = "SELECT * FROM $cat WHERE StockCount >0 ORDER BY Price DESC";
else
$query = "SELECT * FROM $cat WHERE Price='$price' AND StockCount > 0 ORDER BY Price DESC";
// Execute SQL statement
if (!($result = @ mysql_query ($query, $connection)))
showerror();
// starts counter at 0
$counter=-1;
while ($row = @ mysql_fetch_array($result))
{
if($counter == 2){//this will tell us we already have 2 items in the row so start a new row
echo "</tr>";//close the old row
$counter=0; //reset the counter as we will now be starting a new row
echo "<tr>";//start a new row
}
if ($counter == -1) {
//this code will only action on the first time through, after that counter will hold values on 0,1,or 2
$counter=0; //reset the counter to begin
echo "<tr>";//start the first row of the results
}
if($counter < 2){ //if we already have 2 items in the row then we need to start a new row
echo "<td>{$row['StockCode']}</td>
<td>{$row['Description']}</td>
<td>{$row['Price']}</td>
<td><p><a href='{$row['IMGURL']}'><img src='{$row['IMG']}'></img></p></td>
<td><center>{$row['URL']}</center></td>";
if ($counter == 0) echo '<td bgcolor="#FFECFF"> </td>'; //do this to ensure a nice space between the two coloumn
$counter++; //increment the counter to show we have added one item to the current row
}
}//end of while loop
//so now we are out of the while loop, we need to assess how the table ended. how many items are in the last row
//if there is only one then we need to flesh out the second item in that row is to make it look good
if ($counter==1){
echo " <td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>";
}
echo "</td></table>";
}
if($counter == -1)
echo "<br><br><font face='Tahoma' style='font-size: 11pt'>We're sorry, simplyTrue currently do not have any items of jewellery in stock that meet your criteria. Please try your search again or use the <a href='http://www.simplytrue.co.uk/customnotes.htm'><b>Custom Jewellery</b></a> link to request a specific item of jewellery.<br><br>Thankyou, simplyTrue.</font>";
?>
</body>
</html>
Last edited: