Try and have a look at this - please note i've change your product database.
First table "prodgrp"
id | grpname
1 | GroupA
2 | GroupB
3 | GroupC
the second one is "Product"
Id | GrpId | Name
1 | 1 | Item1
2 | 1 | Item2
<?php
//connect to database:
//it's always a good idea to use 'or die' to check if you succeed
mysql_connect("localhost", "root", "mypass") or die(mysql_error());
mysql_select_db("product") or die(mysql_error());
//check if the button has been pressed
if (isset($HTTP_POST_VARS['submit']))
{
//let's just check if there is anything in the textbox submitted
if(isset($HTTP_POST_VARS['prodname']) && strlen($HTTP_POST_VARS['prodname']) > 0)
{
$prodname = $HTTP_POST_VARS['prodname'];
$prodgrp = $HTTP_POST_VARS['prodgrp'];
$qry = "INSERT INTO product VALUES ('',$prodgrp,'$prodname')";
$res = mysql_query($qry) or die("<b>Fehler: Datensatz nicht eingefügt.</b>".mysql_error());
echo "<b>Eintrag erfolgreich übernommen!</b>";
}else
{
echo "<b>Fill out product name!!</b>";
}
}
?>
<form method="POST" action="<? echo $HTTP_SERVER_VARS['PHP_SELF']; ?>">
Produktgruppe Hinzufügen:<br/>
<?
$qry = "SELECT id, grpname FROM prodgrp";
$res = mysql_query($qry) or die(mysql_error());
echo "<select name=prodgrp>";
while($row=mysql_fetch_assoc($res))
{
echo "<option value=".$row['id'].">".$row['grpname']."</option>";
}
echo "</select><br/>";
?>
<input name="prodname" type="text" size="25" maxlength="50"> <br/>
<input type="submit" name="submit" value="Submit">
</form>
This is just to get you started, try and compare this to your old code.