Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Converting a Textbox into a Dropdownlist of DD-MM-YY

Posted on 2006-05-21
2
Medium Priority
?
205 Views
Last Modified: 2008-03-06
Hi,

Currently i use a textbox to get input of date ->
<input id="date" name="date" ...> Format: 2006-01-31

How do i change this into 3 comboboxes of YYYY - MM - , populated with date values
and auto converts it into a string
0
Comment
Question by:jedistar
2 Comments
 
LVL 16

Accepted Solution

by:
dr_dedo earned 600 total points
ID: 16731172
<?
if (isset($_POST['day'])){
      $date=$_POST['day'].'-'.$_POST['month'].'-'.$_POST['year'];
      echo $date;
}

?>
<form actio='' method="POST">
<select name="day">
<?
for ($i=1;$i<32;$i++) echo "<option vlaue='$i'>$i</option>";?>
</select>
<select name="month">
<?
for ($i=1;$i<13;$i++) echo "<option vlaue='$i'>$i</option>";?>
</select>
<select name="year">
<?
for ($i=1990;$i<2011;$i++) echo "<option vlaue='$i'>$i</option>";?>
</select>
<input type="submit">
</form>
0
 
LVL 5

Assisted Solution

by:aminerd
aminerd earned 400 total points
ID: 16731256
$date = $_POST['year'].'-'.$_POST['month'].'-'.$_POST['day'];

;-)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses
Course of the Month21 days, 7 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question