<?php require_once('../Connections/lancrox.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysqli_real_escape_string") ? mysqli_real_escape_string($GLOBALS["___mysqli_ston"], $theValue) : ((isset($GLOBALS["___mysqli_ston"]) && is_object($GLOBALS["___mysqli_ston"])) ? mysqli_real_escape_string($GLOBALS["___mysqli_ston"], $theValue) : ((trigger_error("[MySQLConverterToo] Fix the mysql_escape_string() call! This code does not work.", E_USER_ERROR)) ? "" : ""));

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$colname_Recordset1 = "-1";
if (isset($_GET['owner'])) {
  $colname_Recordset1 = $_GET['owner'];
}
mysqli_select_db( $lancrox, $database_lancrox);
$query_Recordset1 = "SELECT * FROM currentprice WHERE owner ='Raw Materials'";
$Recordset1 = mysqli_query( $lancrox, $query_Recordset1) or die(mysqli_error($GLOBALS["___mysqli_ston"]));
$row_Recordset1 = mysqli_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysqli_num_rows($Recordset1);
?>
<? $product_no=4;
?>
<?php do { ?>
  <p><?php echo $row_Recordset1['items']; ?></p>
  <?php } while ($row_Recordset1 = mysqli_fetch_assoc($Recordset1)); ?>
<?php
((mysqli_free_result($Recordset1) || (is_object($Recordset1) && (get_class($Recordset1) == "mysqli_result"))) ? true : false);
?><?
$sql = "SELECT * FROM currentprice WHERE owner ='Raw Materials'";
$result = mysqli_query($lancrox, $sql);
$row = mysqli_fetch_assoc($sql);

echo "<select name='username'>";
while ($row = mysqli_fetch_array($result)) {
    echo "<option value='" . $row['items'] ."'>" . $row['items'] ."</option>";
}
echo "</select>";
while ($row1 = mysqli_fetch_array($result)) {
    echo "<option value='" . $row1['items'] ."'>" . $row1['items'] ."</option>";
}
echo "</select>";

?>
<table width="674" border="1" cellspacing="3" cellpadding="5">
          <tr>
            <td width="139" bgcolor="#DDDDDD" scope="col">Name</td>
            <td width="500" bgcolor="#DDDDDD" scope="col"><?php echo $row_sel['fullname']; ?></td>
          </tr>
          <tr>
            <td>Phone Number</td>
            <td><?php echo $row_sel['phone']; ?></td>
          </tr>
          <tr>
            <td bgcolor="#DDDDDD">Status</td>
            <td bgcolor="#DDDDDD"><?php echo $row_sel['status']; ?></td>
          </tr>
          <tr>
            <td>Code</td>
            <td><?php echo $row_sel['sn']; ?></td>
          </tr>
          <tr>
            <td bgcolor="#DDDDDD">No of Product Types</td>
            <td bgcolor="#DDDDDD"><label for="product_no"></label><?php echo $_POST[product_no];?></td>
          </tr>
          <tr>
            <td>Products </td>
            <td><?php 
				
				echo "<table cellspacing=10><tr><td>Product</td></tr>";
			
				for($i=1; $i<=$product_no;$i++){
				echo "
				<tr>
				<td>
				<select name=nameproduct$i id=nameproduct>
              		<option value='Lollies Blackcurrant Flavour 100ml'>Lollies Blackcurrant Flavour 100ml</option>
              		<option value='Lollies Orange Flavour 100ml'>Lollies Orange Flavour 100ml</option>
              		<option value='Lollies Pineapple Flavour 100ml'>Lollies Pineapple Flavour 100ml</option>
              		<option value='Ice Cream Vanilla Flavour 100ml'>Ice Cream Vanilla Flavour 100ml</option>
              		<option value='Banana Flavour MilkShake 100ml'>Banana Flavour MilkShake 100ml</option>
					<option value='Banana Flavour MilkShake 200ml'>Banana Flavour MilkShake 200ml</option>
					<option value='Banana Flavour MilkShake 450ml'>Banana Flavour MilkShake 450ml</option>
								</select>
				</td>
				<td>
				<input name=items$i type=text size=3 value=1>
				</td>
								<td>
				<input name=product$i type=hidden size=3 value=$i readonly=readonly>
				</td>
				</tr>
				";
					}echo "</table>";
			?></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td><input type="submit" name="button" id="button" value="Continue" />
              <label for="product">
                <input name="code" type="hidden" id="code" value="<? echo $_REQUEST[code];?>" />
              </label></td>
          </tr>
        </table>
