[thelist] 2 into 1, will it go?

Andre Genic g3nic at lycos.co.uk
Sun Jul 13 13:26:16 CDT 2003


Hi all, remember my last question, "Displaying info according to date" well
thanks to your help I've now got that running, a big thank you to all that
helped me with that one, my next problem is this.

I have a series of PHP generated drop down menus, one for date (today's up
to 90 days) and time based on 24 hours, these go into MySQL as DATE and TIME
instead of the variables I was using before, my problem now is trying to
combine 2 elements from my form into one variable.

So instead of putting DATE and TIME in two fields I want to put them into a
single DATETIME column, is there a way to do this? I've tried and the info
in the DATETIME column gets screwed up, examples of my DATE and TIME drop
downs are below.

DATE:

<?php
   echo "<select name=\"date\">\n";
   for ($i = 0; $i <= 90; $i++) {
      $days = mktime (0,0,0, date("m") ,date("d")+$i, date("Y"));
      $option = date("D M jS y", $days);
      $value = date("Y.m.d", $days);
      if ($value == "date") {
         $selected="selected";
      }
      echo "<option value=\"$value\" $selected>$option</option>";
   }
   echo "</select>\n";
?>

TIME:

<?php
   echo "<select name=\"time\">\n";
   for ($i = 0; $i <= 23; $i++) {
      $time = mktime (00+$i,00, date("G"), date("i"), date("a"));
      $option = date("g:00 a", $time);
      $value = date("G:00:00", $time);
      if ($value == "time") {
         $selected="selected";
      }
      echo "<option value=\"$value\" $selected>$option</option>\n";
   }
   echo "</select>\n";
?>

Andre.

(I would sooner ask a question and look stupid, because if you don't ask you
will never know)



More information about the thelist mailing list