Code:
<html>
<head>
<script type="text/javascript" src="datetimepicker.js">
function validation() {
document.form2.flag.value="insert";
document.form2.submit();
}
</script>
</head>
<body bgcolor=#c3e393>
<?php
include("dbconnection.php");
$txtname=$_POST['txtname'];
$txtdivision=$_POST['txtdivision'];
$txtdept=$_POST['txtdept'];
$txthod=$_POST['txthod'];
$txtsdate=$_POST['txtsdate'];
$txtfdate=$_POST['txtfdate'];
$txtbudget=$_POST['txtbudget'];
$txtpriority=$_POST['txtpriority'];
$txtpcode=$_POST['txtpcode'];
$txtsname=$_POST['txtsname'];
$txtptype=$_POST['txtptype'];
$txturl=$_POST['txturl'];
$txtstatus=$_POST['txtstatus'];
$flag=$_POST['flag'];
$query=pg_query("INSERT INTO project(projname,division,department,startdate,finishdate,budget,priority,projectcode,shortname,projecttype,url,status,hod) VALUES ('$txtname','$txtdivision','$txtdept','$txtsdate','$txtfdate','$txtbudget','$txtpriority','$txtpcode','$txtsname','$txtptype','$txturl','$txtstatus','$txthod')");
?>
<form name="form2" method="POST" action="project.php" >
<input type="hidden" name="flag" value="<?php echo $flag; ?>">
<table align=center>
<h2 align=center>Project Details</h2>
<tr>
<td>
<strong>Project code :<strong>
</td>
<td>
<input id="pcode" type=text name="txtpcode" value="<?php echo $txtpcode; ?>"/>
</td>
</tr>
<tr>
<td>
<font size=3>
<strong>Name of the Project :</strong>
</td>
<td>
<input id="name" type=text name="txtname" value="<?php echo $txtname; ?>"/>
</td>
</tr>
<tr>
<td>
<strong>Short Name :<strong>
</td>
<td>
<input id="sname" type=text name="txtsname" value="<?php echo $txtsname; ?>"/>
</td>
</tr>
<tr>
<td>
<font size=3>
<strong>Division :</strong>
</td>
<td>
<input id="division" type=text name="txtdivision" value="<?php echo $txtdivision; ?>"/>
</td>
</tr>
<tr>
<td>
<font size=3>
<strong>Department :</strong>
</td>
<td>
<input id="dept" type=text name="txtdept" value="<?php echo $txtdept; ?>"/>
</td>
</tr>
<tr>
<td>
<font size=3>
<strong>Department HOD :</strong>
</td>
<td>
<input id="hod" type=text name="txthod" value="<?php echo $txthod; ?>"/>
</td>
</tr>
<tr>
<td>
<font size=3>
<strong>Start Date :</strong>
</td>
<td>
<input id="demo1" type="text" name="txtsdate" value="<?php echo $txtsdate; ?>"><a href="javascript:NewCal('demo1','ddmmyyyy')"><img src="cal.gif" width="16" height="16" border="0" alt="Pick a date"></a>
</td>
</tr>
<tr>
<td>
<strong>Target Finish Date :<strong>
</td>
<td>
<input id="demo2" type="text" name="txtfdate" value="<?php echo $txtfdate; ?>"><a href="javascript:NewCal('demo2','ddmmyyyy')"><img src="cal.gif" width="16" height="16" border="0" alt="Pick a date"></a>
</td>
</tr>
<tr>
<td>
<strong>Budget :<strong>
</td>
<td>
<input type="checkbox" name="txtbudget" value="y" /> yes
<input type="checkbox" name="txtbudget" value="n" /> no
</td>
</tr>
<tr>
<td>
<strong>Priority :<strong>
</td>
<td>
<select name="txtpriority">
<option value="1">Low</option>
<option value="2">Medium</option>
<option value="3">High</option>
</select></div>
</td>
</tr>
<tr>
<td>
<strong>Project Type :<strong>
</td>
<td>
<input id="ptype" type=text name="txtptype" value="<?php echo $txtptype; ?>"/>
</td>
</tr>
<tr>
<td>
<strong>URL of the project :<strong>
</td>
<td>
<input id="url" type=text name="txturl" value="<?php echo $txturl; ?>"/>
</td>
</tr>
<tr>
<td>
<strong>Status :<strong>
</td>
<td>
<select name="txtstatus">
<option value="1">initialization</option>
<option value="2">Study</option>
<option value="3">SRS</option>
<option value="4">Design</option>
<option value="5">Coding</option>
<option value="6">Testing</option>
<option value="7">Implementation</option>
</select>
</td>
</tr>
</table>
<center>
<table>
<tr>
<td><input type=button value="Submit" name="b1" onClick="return validation()";/></td>
<td><input type="Reset" name="b2"></td>
</tr>
</table>
</center>
</form>
</body>
</html>
Comment