Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP Databases
| Search | Today's Posts | Mark Forums Read
PHP Databases Using PHP in conjunction with databases. PHP questions not specific to databases should be directed to one of the other PHP forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 28th, 2004, 10:44 PM
Registered User
 
Join Date: Jul 2004
Location: , , .
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Date And Time Problem

I have a mysql table column has a date field type which the format is 0000-00-00. Another column is for time format in mysql 00:00:00

So I got dropdown box to let user choose from 00 ~ 23. It is a 24hr format.
I have a drop down box created with some coding using php.
How can i use store this variable $date into the date column?
So how do I change it such that the value can be accepted as a date format?

Code:
echo "<tr>";
        echo "<td>Date:</td>";
        echo "<td>";
                echo "<select name = 'date'>";
                $i=0;
                $current_date = date("Y-m-d",time());
                while ($i<7){
                $add_date = date("d-m-Y",strtotime("$current_date + $i days"));
                echo "<option>$add_date</option>";
                $i++;
                }
                echo "</select>";
        echo "</td>";
        echo "</tr>";
       .
       .
       .
$sdate = $_POST['date']; 

echo "<tr>";
        echo "<td>End Time:</td>";
        echo "<td>";
        echo "<select name='betimes'>";
         foreach ($btimes as $etime){
          echo "<option>$etime</option>";
         }
        echo "</select>";  
        echo " : 00";
        echo "</td>";   
        echo "</tr>";

$etime = $_POST['betimes'];




Similar Threads
Thread Thread Starter Forum Replies Last Post
date-time problem naveed77 Beginning VB 6 0 February 3rd, 2007 11:43 AM
date-time problem naveed77 Beginning VB 6 0 February 1st, 2007 07:13 AM
problem displaying records in order of time ,date method PHP Databases 3 July 25th, 2006 08:16 PM
Date and Time Problem. rupen Classic ASP Professional 1 June 6th, 2006 06:00 AM
print time and date problem zouky Crystal Reports 0 November 11th, 2004 10:32 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.