sandrine Posted May 19, 2009 Share Posted May 19, 2009 hi ok i know how to insert data into a mysql using forms and php scripts but i would like to insert date/time from a webpage on my site into mysql. The date/time are auto generated and displayed on my webpage via a php scipt that is running on the webpage. Is there a way to include the output of the date/time php script in the the rest of the form that follows it i.e so when users enter their name and a image and click upload the date/time will also be passed on to the php script that inserts the name/image into the mysql. just to recap i have a webpage with a form where users enter their name/image and click uplaod and the values get passed to a php script that inserts the values into mysql but i would like the date/time that is being displayed on the same page to be passed on to the insert php script aswell. i cant use the timestamp option in my mysql to auto generate the date/time as the server of mysql is in the usa and iam in the uk and so the date/time recorded is always wrong and as iam using a free host so i cant change the server time zone via .htaccess or php.ini or any other way till i upgrade and pay for hosting which i dnt want to do as iam just learning at the moment. below is the time.php script that generates and displays the date/time on my website and also below is the simple form script on the same page. hope some one can help. <?php $hourdiff = "14"; // hours difference between server time and local time $timeadjust = ($hourdiff * 3600); $melbdate = date("l, d F Y h:i a",time() + $timeadjust); print ("$melbdate"); ?> form script <form method="post" enctype="multipart/form-data" action="file-upload.php"> <div><?php echo $message; ?></div><?php echo $max_file_size_tag; ?> Name: <input name="name" type="text"><br> Please select file to upload: <input type="file" size="20" name="filename"> <input type="submit" value="Upload" name="submit"> </form> Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.