Dear Experts,
I'm newbie in php. Can anyone please help to check my code as below: Blank value inserted to Mysql using dropdownbox. Thanks in advance.
<?php
mysql_connect("localhost","root","") or die("Error: ".mysqlerror());
mysql_select_db("project_Test");
$Serial_Number = $_GET['Serial_Number'];
$sql = "select * from `TestTable` where Serial_Number = $Serial_Number";
$query = mysql_query($sql);
$row = mysql_fetch_array($query);
$Serial_Number = $row['Serial_Number'];
$Customer = $row['Customer'];
$Date = $row['Date'];
$Model = $row['Model'];
$result = mysql_query("SELECT * FROM Customer");
?>
<html>
<head>
<title>Edit User Info</title>
</head>
<body>
<form action="updateinfo.php" method="post">
Serial Number:<br/>
<input type="int" value="<?php echo $row['Serial_Number'];?>" name="Serial Number" />
<br/>
Customer:<br/><Select name='access'>
<?php
while ($row = mysql_fetch_array($result)) {
?>
<option value="<?php echo $row['Customer']; ?>" <?php if ($Customer == $row['Customer']) { echo 'selected'; } ?> ><?php echo $row['Customer']; ?></option>
<?php } ?>
</select>
<br/>
Date:<br/>
<input type="date" value="<?php echo $Date;?>" name="Date"/>
<br/>
Model:<br/>
<input type="varchar" value="<?php echo $Model;?>" name="Model"/>
</br>
<input type="submit" value="submit changes"/>
</form>
</body>
</html>