Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Function

Status
Not open for further replies.

maharamDan

IS-IT--Management
Joined
Mar 22, 2004
Messages
31
Location
US
Hello I am trying to pass a Date field to a database in a form.

I am trying to make the function hidden however it is not working. This is what I have

if($do == "addevent")
{
echo Please fill out the form :<br>

<form action=admin.php method=post name=myform>
<input type=hidden name=do value=addnews2>
$today = date("F j, Y, g:i a");
<input type=hidden name=date value=$today>

Title:<input type=text name=title> </input>
}
if($do == "addnews2")
{
$query = mysql_query("insert into news values('','$title','$date')");

echo "News Event added successfully<br><br></b>

<a href=admin.php>Back to Admin Area</a><br><br>
";

}

i dont know if I am taking the wrong approach. By the way how do you get the Code text area on tek-tips?

Thanks in advance.
 
Try taking the quotes out of the date function, I.E.:

Code:
$today = date(F j, Y, g:i a);

Hope this helps!

P.S.
you make the code window by doing:
Code:
 [code\] (just put stuff in between them)

You can do another cool box by doing the same thing, except using the word quote.

Peace out,
Peace Co.
 
Thanks for the help I just put the dat function out side the if statement. Thanks again.
 
No problem. It's always nice to be thanked by someone.

Peace out,
Peace Co.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top