I'm using php 5.5.3..In my scenario i have created a form to insert a task on which user have to fill 3 field namely description of task,due date and priority of task..immediately after that i have added a submit button..whenever i'm going to click on submit button the values should entered in database is my task. Now i wanna asked that how should i add due due date in database..i have tried with specific format but it doesn't work..my configuration id like :
Task.html :
<html>
<head>
<title>Creating a Personal To-Do List</title>
<h3>Add new Task</h3>
</head>
<body>
<form method="post" action="task.php">
    Description :
        <br/>
        <input type="text" name="name"/>
              <p>
    Due date :
        <br/> 
        <input type="text" name="date" size="20"/>
        <p><br/>
    Priority :
        <br/>
        <select name="priority">
        <option name="high">High</option>
        <option name="medium">Medium</option>
        <option name="low">low</option>
        </select>
    <p>
    <input type="submit" name="submit" value="Save Task">
</form>
</body>
</html>
And Task.php :
<?php
$db_hostname="localhost";
$db_database="music";
$db_username="root";
$db_password="p3";
if(isset($_POST['submit']))
{
    if(empty($_POST['name']))
      die("Error : Task name is required");
    $name=$_POST['name'];
    if(empty($_POST['date']))
     die("Error : Please enter a valid date");
$task_date = $_POST['date'];
    if(empty($_POST['priority']))
     die("Error : Please select a priority");
    $priority=$_POST['priority'];
$db_server=mysql_connect($db_hostname,$db_username,$db_password);
if(!$db_server)
  {
    die("Error:unable to connect to server");
  }
else 
    echo "Connected to server";
mysql_select_db($db_database)
    or die("Error:unable to connect to database");
    echo "</br>Connected to $db_database database";
  $task_date = date('Y-m-d');
echo $task_date;
$insert_query=mysql_query("Insert into task(name,due,priority)values('$name','$task_date','$priority'))");
if(($insert_query)==TRUE)
{   
    echo "<br/>";
    echo "New Task inserted ";
}
}
?>
Please let me know where should i make changes?or is their any another way to do this?..
 
     
    