Jump to content

Recommended Posts

Hi
i hope someone can help me, i am still very new to coding

[!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]strOutput += "<TD CLASS=\"entry\<input type=hidden name=Date value="???????????"></TD>";[!--colorc--][/span][!--/colorc--]

is the above code correct so far and what do i have to replace ????????????????? with so that it will save todays date (and time if possible) into my database

anyone who can help me please greatly appreciated

regards
scottt
Link to comment
https://forums.phpfreaks.com/topic/8627-adding-date-to-hidden-field/
Share on other sites

Hi there,

To get the date using javascript,, you could try something like:
[code]
<html>
<body>

<script>
var d=new Date();
</script>

<table>
<tr>
<td><input type=hidden name=Date id=Date></td>
</tr>
</table>

<script>
document.getElementById('Date').setAttribute("value",d);
// debug line:
alert('date is: '+document.getElementById("Date").getAttribute("value"));
</script>
</body>
</html>
[/code]

Some tips (hmm, maybe in french,,) on this site: [a href=\"http://www.asp-php.net/tutorial/scripting/dates.php\" target=\"_blank\"]date functions & javascript[/a]

But you will need to use php/Mysql to save the dates into your database,...

So, better use php like:
1- get the date with php date function,
2- save it using mysql into a database

Hoping it helps,

l8tr,,
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.