Jump to content

insert date/time from a webpage on my site into mysql


sandrine

Recommended Posts

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>

ok i have tried doing that but can not figure out how i would include the date/time outputted by the php script into the hidden field before posting it along with the rest of form. xcuse my ignorance iam a newbie at this and yeah which forum should this be in anyway.

 

thanx

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.