Link to home
Start Free TrialLog in
Avatar of RonnieBrown
RonnieBrown

asked on

Entering Dates from separate dropdowns

Hi

I'm trying to enter a date into a MySQL database using php via three dropdown lists on a web page - one for day, one for date and one for month.

I'm very much a php/mysql novice so any help much appreciated.

Thanks
Avatar of RonnieBrown
RonnieBrown

ASKER

I should also say that the following is the code I'm using:

if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "insert_job")) {
  $insertSQL = sprintf("INSERT INTO job_book (JOB_NO, `DATE`, CLIENT, JOB_DESCRIPTION, CLIENT_CONTACT, CO_CONTACT) VALUES (%s, %s, %s, %s, %s, %s)",
                       GetSQLValueString($HTTP_POST_VARS['jobNum'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['yyyy'], "date"),
                       GetSQLValueString($HTTP_POST_VARS['client'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['job_desc'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['client_contact'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['co_contact'], "text"));

  mysql_select_db($database_jobConn, $jobConn);
  $Result1 = mysql_query($insertSQL, $jobConn) or die(mysql_error());

  $insertGoTo = "view.php";
  if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
}

Where 'yyyy' is the value of one of the drop downs.  Basically I need to replace this with a concated string consisting of "yyyy", "mm" and "dd".

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Richard Quadling
Richard Quadling
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks mate - that works great.