<link href="css/form.css" type="text/css" rel="stylesheet" media="screen"  />
<html>
<body >

<?
session_start();
include("opendb.php");
include ("test.php");
?>
<head>
</head>

<?
if($sv)
{
 $sql="update inquiry set model='$model', segment='$segment' where inqno='$inqno' and exec='$user'";
  mysqli_query($db,$sql)or die(mysqli_error());
}
if($edit)
{
$res1=mysqli_query($db,"select * from inquiry  where exec='$user' and inqno='$inqno'")or die(mysqli_error());
 $row=mysqli_fetch_array($res1);
 print "<center>";
 print "<form action='$PHP_SELF' method='post'><input type=hidden name='inqno' value='$inqno'>";
 print "<table border=0><th colspan=2>Change Model</th>";
 print "<tr><td>Prospect</td><td>$row[prospect]</td></tr>";
 print "<tr><td>Existing Model</td><td>$row[model]</td></tr>";
 print "<tr><td>Change Model to </td><td>";
?>
<select name='model'>
<?
$re= mysqli_query($db,"select * from premodel order by model");
while($row1=mysqli_fetch_array($re))
{
 print "<option>$row1[model]</option>";
}
?>
</select>
</td></tr>
<tr><td>Existing Segment </td><td><?print $row[segment]?>
<tr><td>Change Segment to </td><td><select name='segment'>
<?
 print "<option>$row[segment]</option>";
 $segres=mysqli_query($db,"select * from seg_master order by sname");
 while($segrow=mysqli_fetch_row($segres))
  print "<option>$segrow[1]</option>";
?>
</select></td></tr>    

<tr><th colspan=2 align=center><input type=submit value='Save' name='sv'></td></tr>
</table>
</form>

<?
return;
}
?>
<table cellspacing=1 cellpadding=3 bgcolor='steelblue' width=100%>
<th>Inq NO <th>Inq Date <th>Inq Source <th>Prospect <th>Model <th>Rate <th>Action
<?
$res=mysqli_query($db,"select * from inquiry where phead = '$user' order by inqdate desc")or die(mysqli_error());
while($row=mysqli_fetch_array($res))
{
 print "\n<tr bgcolor='white'><form action='$PHP_SELF'><input type=hidden name='inqno' value='$row[inqno]'><td>$row[inqno]</td> <td>".datetohtml($row[inqdate])."</td> <td>$row[isource]</td>";
 $pres=mysqli_query($db,"select pname from prospmaster where pcode='$row[prospect]'");
 $prosrow=mysqli_fetch_array($pres);
 print " <td>$prosrow[0]</td> <td>$row[model]</td> <td align=right>$row[rate]</td> </form></tr>";

}
?>
</table>
