...

View Full Version : Combining Form Variables



CrazyCoder
11-10-2006, 09:01 PM
Okay, hopefully this is an easy one. I have a form on which a user can select a date in one field and a time in another. I need to combine these two variables into a single datetime variable to put in the database. I've looked all over and can't seem to find any good info on this. Everything else I am sending to the database works just fine.

Here is what doesn't work [it throws a parser error]:


<?php
$db_host = "*****";
$db_user = "*****";
$db_pwd = "*****";
$db_name = "contentdb";

mysql_connect($db_host, $db_user, $db_pwd) or die('Could not connect to mysql server: '. mysql_error());
mysql_select_db($db_name) or die('Could not select database: '. mysql_error());

$publishdatetime = $_GET["publishdate"] + $_GET["publishtime"];

$result = mysql_query("insert into main_articles (publishdatetime) values ('$publishdatetime');

mysql_close();
?>

Scriptbanger
11-10-2006, 09:25 PM
This should help:

http://www.developer.com/lang/php/article.php/938511 (http://www.developer.com/lang/php/article.php/938511)

CrazyCoder
11-10-2006, 09:27 PM
That's just what I needed. Thanks Scriptbanger. :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum