Code: Select all
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO beauStock (StockID, ID, SizeID) VALUES (%s, %s, %s)",
GetSQLValueString($_POST['StockID'], "int"),
GetSQLValueString($_POST['ID'], "text"),
GetSQLValueString($_POST['SizeID'], "text"));
mysql_select_db($database_beau, $beau);
$Result1 = mysql_query($insertSQL, $beau) or die(mysql_error());
$insertGoTo = "size-list.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
mysql_select_db($database_beau, $beau);
$query_Recordset1 = "SELECT * FROM beauProd";
$Recordset1 = mysql_query($query_Recordset1, $beau) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
mysql_select_db($database_beau, $beau);
$query_Recordset2 = "SELECT * FROM beauSizeList";
$Recordset2 = mysql_query($query_Recordset2, $beau) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);
<select id="ID" name="ID">
<option value="select product name">select product name</option>
<?php
do {
?>
<option value="<?php echo $row_Recordset1['ID']; ?>"><?php echo $row_Recordset1['name']; ?></option>
<?php
} while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
$rows = mysql_num_rows($Recordset1);
if($rows > 0) {
mysql_data_seek($Recordset1, 0);
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
}
?>
</select>
<select name="SizeID">
<option value="select Size">Select Size</option>
<?php
do {
?>
<option value="<?php echo $row_Recordset2['SizeID']; ?>"><?php echo $row_Recordset2['Size']; ?></option>
<?php
} while ($row_Recordset2 = mysql_fetch_assoc($Recordset2));
$rows = mysql_num_rows($Recordset2);
if($rows > 0) {
mysql_data_seek($Recordset2, 0);
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
}
?>
</select>
thanks in advance