treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Todays date as default value for input field

  • Hello all, I have an input field for the user to enter a date in, but most of the time they will want todays date, so I'm looking for some code, could be JS, PHP or jQuery. to put into my value="" in the input box to save them the work.

    I've tried and the code shows not the date. I tried <?php $thedate = date("y-m-d"); ?> because I read that javascript would be easy toy for hackers in this situation.

    I need the date in this format 20130215 ymd

    Your ideas are appreciated.

  • $thedate = date("Ymd");

    Where have you read that JavaScript here would be vulnerable to hacking? It's not true :)