Date and time in php

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

zainmr89
New php-forum User
New php-forum User
Posts: 1
Joined: Mon Jun 03, 2013 3:21 am

Date and time in php

Postby zainmr89 » Mon Jun 03, 2013 3:42 am

How to add time in mysql database from a textbox.

<form name="addTime" action="<?php echo $SERVER['PHP_SELF']; ?>" method="post">
<input type="text" name="time" />
<input type="submit" name="enterTime" />
</form>

developerahusain
New php-forum User
New php-forum User
Posts: 44
Joined: Tue May 28, 2013 10:04 pm
Location: India,Lucknow

Re: Date and time in php

Postby developerahusain » Mon Jun 03, 2013 9:07 am

<form name="addTime" action="<?php echo $SERVER['PHP_SELF']; ?>" method="post">
<input type="text" name="time" value="<? echo date('l, F j, Y ')."&nbsp;".date ("h:i:s") ?>" />
<input type="submit" name="enterTime" />
</form>

Here is the code friend

developerahusain. Any other problem do revert

johnmacd
New php-forum User
New php-forum User
Posts: 19
Joined: Wed Jun 12, 2013 9:30 pm
Contact:

Re: Date and time in php

Postby johnmacd » Thu Jun 13, 2013 10:51 pm

establish connection with database.
then take the value in text box in variable $time=$_REQUEST["time"];
then using insert query insert data into database.


Return to “PHP coding => General”

Who is online

Users browsing this forum: Baidu [Spider] and 5 guests