rendered paste body<? include("config.php"); ?>
<html>
<head>
<script src="select.js"></script>
</head>
<body>
<form id="form1" name="form1" method="post" action="insert_item.php">
<input name="name" type="text" id="name" />
<br />
<input type="checkbox" name="green" value="green"> <img src="img/greenchem_icon.png" /> Green Product<br>
<input type="checkbox" name="eco" value="eco"> <img src="img/ecocert_icon.png" /> ECO Cert<br>
<input type="checkbox" name="dfe" value="dfe"> <img src="img/DfE_icon.png" /> DfE Cert<br><br>
//between here
<?
$query="SELECT name,id FROM category";
$result = mysql_query ($query);
echo "<select name=cattag_1 value='' onchange=showUser(this.value)>CatTag 1</option>";
// printing the list box select command
while($nt=mysql_fetch_array($result)){//Array or records stored in $nt
echo "<option value=$nt[id]>$nt[name]</option>";
/* Option values are added by looping through the array */
}
echo "</select>";
?>
<p>
<div id="txtHint"><b>Subcategory info will be listed here.</b></div>
</p>
//and here
<input type="submit" name="Submit" value="Submit" />
</form>
</body>
</html>
txtHint div code:
<?
include("config.php");
$count = 0;
$varcount = 1;
$sql="SELECT * FROM subcategory WHERE $q IN(tag_1, tag_2, tag_3, tag_4, tag_5)";
$result = mysql_query($sql);
echo "<table border='1'>
<tr>
<th>Subcategory</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td><input type=\"checkbox\" name=\"subtag_". $varcount ."\" value=\"" . $row['id'] . "\">" . $row['name'] . " subtag_" . $varcount . "</td>";
echo "</tr>";
$varcount++;
}
echo "</table>";
?>