MHB2011
MHB2011

Reputation: 463

Datetime not working (php+html)

I have problem with datetime input ... In HTML code I add datetime but its showing just regular form... I will post some pictures for u to beter understand what i mean... This is html code:

<form method='post'>
<br>Sport:<br>
<select name='sport'>
<option value='football' selected>Football</option>
<option value='basketball'>Basketball</option>
<option value='tennis'>Tennis</option>
<option value='hockey'>Hockey</option>
<option value='handball'>Handball</option>
<option value='volleyball'>Volleyball</option>
<option value='baseball'>Baseball</option>
<option value='waterpolo'>Water polo</option>
<option value='other'>Other</option>
</select>
<br>Starting time:<br>
<input type='datetime' name='start'/>
<br>Home:<br>
<input type='text' name='home'/><br>
Away:<br>
<input type='text' name='away'/><br>
Pick:<br>
<input type='text' name='pick'/><br>
Odd:<br>
<input type='number' step='0.01' name='odd'/><br>
Stake:<br>
<input type='number' step='0.01' name='stake'/><br>
Analysis:
<br><textarea style='width:100%;' rows='20' name='analiza'></textarea>
<input type='submit' value='Place a bet' name='postavi'/>
</form>

But datetime look like this :

enter image description here

And i dont want to look like this , i want regular datetime witch look like this :

enter image description here

Thanks everyone who try to help . Cheers , Toni.

Upvotes: 0

Views: 1053

Answers (3)

Almis
Almis

Reputation: 3809

Some browser have implemented datetime but then removed it (not sure why). To see which browsers support DateTime input check caniuse.com/input-datetime

Edit: use javascript plugin like JQuery Datepicker

Example from Jquery page:

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>jQuery UI Datepicker - Default functionality</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
  <script src="//code.jquery.com/jquery-1.10.2.js"></script>
  <script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css">
  <script>
  $(function() {
    $( "#datepicker" ).datepicker();
  });
  </script>
</head>
<body>

<p>Date: <input type="text" id="datepicker"></p>


</body>
</html>

Upvotes: 2

Kevin Lynch
Kevin Lynch

Reputation: 24703

You need the datepicker function that is part of the jQueryUI libray

DEMO http://jsfiddle.net/Fa8Xx/1768/

jQuery UI link

The is also the HTML5 date type attribute. This heavily relies on HTML browser support though.

DEMO http://jsfiddle.net/Fa8Xx/1769/

 <input type="date" />

Upvotes: 1

Studocwho
Studocwho

Reputation: 2478

I believe you need the datetime-localtype instead. So the HTML would look like this:

<input type='datetime-local' name='start'/>

Upvotes: 0

Related Questions