Code:
<form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post" enctype="multipart/form-data" name="form1">
<table width="69%" border="0" align="center">
<tr>
<td width="25%">Date</td>
<td width="75%"><input name="date" type="text" size="40" id="date" value="<?php echo date("Y-m-d")?>" ></td>
</tr>
<tr>
<td>Hours</td>
<td><input name="hours" type="text" size="40" id="hours"></td>
</tr>
<tr>
<td>Work Details</td>
<td><textarea name="work" cols="22" rows="4" id="work"></textarea></td>
<input name="memberid" type="hidden" size="40" value="<?php echo $myusername; ?>">
</tr>
<tr>
<td colspan="2" align="center"><input name="submit" type="submit"></td>
</tr>
</table>
</form>
<?php
if(isset($_POST['submit']))
{
$date=$_POST['date'];
$hours=$_POST['hours'];
$work=$_POST['work'];
mysql_connect("localhost","root","") or die(mysql_error());
mysql_select_db("secure_login")or die(mysql_error());
$insert="INSERT into member_details(date,hours,message,member_name) values('$date','$hours','$work',$myusername)";
$result=mysql_query($insert);
if($result)
{
echo "Insert the data";
}
else
{
echo "not insert data ..." .mysql_error();
}
}
else
{
echo "<script> alert('Enter the all fields');</script>";
}
?>
</body>
</html>
Comment