html drop down list, edit selected values

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sectionLeader123
Forum Commoner
Posts: 31
Joined: Fri Oct 11, 2013 8:46 am

html drop down list, edit selected values

Post by sectionLeader123 »

In the following code I have a drop down list with a date/time stamp echoed inside the list. The date/time stamp is defaulted to that particular days date and time. But what I would like to do is say when I select the job accepted option in the list I want to be able to edit the date and the time by simply clicking on it and then key in the desired date or time.
Any help would be greatly appreciated thanks:

Code: Select all

<?php
date_default_timezone_set('Europe/London');
$datestamp = date('d/m/Y h:i:s a', time());
?>
<html>
<head>
</head>
<body>
<select id="status"> 
<option value="Please Select">Please Select</option>
<option value="Job Accepted <?php echo $datestamp;?>" >Job Accepted <?php echo $datestamp;?></option>
</select>
</body>
</html>
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: html drop down list, edit selected values

Post by Christopher »

If you want to edit the date, then I assume that it is stored somewhere. So attempt to load the stored date. If the stored date exists, then set $datestamp to the stored value. If it does not exist, then set it to the current date.
(#10850)
sectionLeader123
Forum Commoner
Posts: 31
Joined: Fri Oct 11, 2013 8:46 am

Re: html drop down list, edit selected values

Post by sectionLeader123 »

Appreciate the input Christopher but I am going to pass the value from the drop down list to a textbox and edit the date there. Seems to be easiest way to do it. Many thanks.
Post Reply