well hello guys want to ask for your help in improving this code. Please help me. First things first I have a database name called quotation and it has 4 fields namely Id, Date, Product and Price. Well I want to get the name of the product in the drop down and its corresponding price then store it in the database. My teacher told me I'll be using arrays but I don't really know how to use it specially that I'm new with this kind. Please help me :) thanks in advance
<?php
include("connect.php");
if(isset($_REQUEST['submit'])){
$cabbage=$_REQUEST['cabbage'];
$prcabbage=$_REQUEST['PRcabbage'];
$beans=$_REQUEST['beans'];
$prbeans=$_REQUEST['PRbeans'];
$carrots=$_REQUEST['carrots'];
$PRcarrots=$_REQUEST['PRcarrots'];
$date=$_REQUEST['date'];
$query="INSERT into quotation(Id, Date, Product, Price) VALUES ('', '$date',
'$cabbage', '$prcabbage', '$beans', '$prbeans', '$carrots','$prcarrots')";
mysql_query=($query);
$count=mysql_affected_rows;
if($count==1){
echo "Data Sent!";
}else{
echo "Error";
}
}
?>
<html>
<table border="1" cellpadding="2">
<form name="form" method="get" action="form.php">
<label>Date of quotation</label>
<input type="text" name="date"><br/>
<th>Description</th>
<th>Bid Price</th>
<tr>
<td><select name="cabbage">
<option>cabbage</option>
</select></td>
<td><input type="text" name="PRcabbage"></td>
</tr>
<tr>
<td><select name="beans">
<option>Beans</option>
</select></td>
<td><input type="text" name="PRbeans"></td>
</tr>
<tr>
<td><select name="carrots">
<option>Carrots</option>
</select></td>
<td><input type="text" name="PRcarrots"></td>
</tr>
</table>
<br/><br/>
<input type="Submit" name="submit" value="submit">
</form>
</html>