/    Sign up×
Community /Pin to ProfileBookmark

Add date to field automatic

Good day to all,
I would like to add the date and time (30/12/2007 — 22h00) automaticly to a field and also make that the user can’t change it ?

I need “affiche” in the code below to have automaticly the date and time formated like (30/12/2007 — 22h00) .

Can somebody at least point me to what I should do?

[code=php]
<tr><td bgcolor=”#cccc99″ width=”600″ valign=”top”><table border=”0″ align=”left” cellspacing=”1″ cellpading=”0″ width=600 valign=”top”>
<tr><td width=”600″ valign=”top” align=”left” class=”black”>
Nom : <input type=”text” name=”nom”><br>
Date d’affichage : <input type=”text” name=”affiche”><br>
Courriel : <input type=”text” name=”courriel”><br>
&Eacute;v&egrave;nement : <input type=”text” name=”evenement”><br>
Date de l’ &eacute;v&egrave;nement : <input type=”text” name=”date”><br>
Commentaire ou texte :<br>
<textarea name=”commentaire” rows=”10″ cols=”60″></textarea><br>
[/code]

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@hastxMay 27.2007 — There are 2 ways to do it:
[LIST=1]
  • [*]Have a script run on the form page to pass the date to the submit page in a hidden input. (this isn't good because if the user is on the page for a half hour prior to submitting, you will get an inaccurate time.)

  • [*]The other way is to append the date to the input on the submission page(which will reflect the actual time of submission):

  • [/LIST]


    [code=php]
    $date=date('d/m/Y -- H:i');
    $affiche=$_POST['affiche'];
    $affiche_append="$affiche"."$date";
    [/code]
    ×

    Success!

    Help @Peuplarchie spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.13,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...