I am not able to insert automatic date and time in database from frontend form page.Please help me.
<b><input type="datetime" name="DateTime" value="NOW()"/></b>
<br/> <b>Name:</b>
<input type="text" name="name" />
</b>
<br/> <b>Subject:</b>
<input type="text" name="subject" />
</b>
<br/> <b>E-mail:</b>
<input type="text" name="email" />
</b>
<br/> <b>Contact Number:</b>
<input type="text" name="contact_number" />
<br/>
</p>
<p><b>Please describe your health related problem:</b>
<br/>
<textarea name="comment" rows="3" cols="40"></textarea>
<br/> <b>Select case paper/reports-1 to upload (if any):</b>
<br/>
<input type="file" name="report_one" id=" report_one "> <b>Select case
paper/reports-2 to upload (if any):</b>
<br/>
<input type="file" name="report_two" id=" report_two ">
<br/>
</p>
<p>
<input type="submit" name="submit" class="rainbow_border" value="Send
it!">
</p>
</form>
Back End is(back_end.php):
$DateTime=$_POST['DateTime'];
$name=$_POST['name'];
$subject=$_POST['subject'];
$email=$_POST['email'];
$contact_number=$_POST['contact_number'];
$comment=$_POST['comment'];
$insert_query="INSERT INTO casepaper (id, DateTime, name, subject, email,
contact_number, comment, case_paper_path_one, case_paper_path_two)
VALUES('$id', '$DateTime', '$name', '$subject', '$email', '$contact_number',
'$comment', '$case_paper_path_one', '$case_paper_path_two')";
$connection->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
$statement=$connection->prepare($insert_query);
$statement->bindValue(':id', $id, PDO::PARAM_STR);
$statement->bindValue(':DateTime', $DateTime, PDO::PARM_STR);
$statement->bindValue(':name', $name, PDO::PARAM_STR);
$statement->bindValue(':subject', $subject, PDO::PARAM_STR);
$statement->bindValue(':email', $email, PDO::PARAM_STR);
$statement->bindValue(':contact_number', $contact_number, PDO::PARAM_STR);
$statement->bindValue(':comment', $comment, PDO::PARAM_STR);
$statement->bindValue(':case_paper_path_one', $case_paper_path_one,
PDO::PARAM_STR);
$statement->bindValue(':case_paper_path_two', $case_paper_path_two,
PDO::PARAM_STR);
$statement->execute();
}else{
echo "Sorry, there was a problem uploading your file.";
}
//--reports end--//
ob_start();
header('location:thanks.html');
?>
I'm little bit confused what type,name & value attribute should be there in html form and process back end accordingly and insert successfully in to database.
Thanks in advance.