Getting date data

Hi, I seem to have a problem getting the date to display in my database. Everything else works just fine, it even shows the date on the form when I changed the input type from hidden to text. All I get in my row in the database is the word “date”.

I’m thinking it must be something simple I’m missing, either that or I’m coming at the problem the complete wrong way as I’m fairly new to PHP.

[php]

<?php
if ($_SESSION['username'])
{
	echo "Welcome, " . $_SESSION['username'] . "<br><a href='logout.php'>Logout</a></br>";
}
else
{
	die("You must be logged in");
} 
?>
<p></p>
<form method="post" action="member.php">
	<input type="hidden" name="add" value="true" />
	<div>
	<label for="title">Title:</label>
	<input type="text" name="title" />
	<>
    <input type="hidden" name="date" value="<? echo date("M d, Y"); ?>" />
    <div>
    <label for="body">Body:</label>
    <textarea name="body" id="body" rows="8" cols="40" </textarea>
    <>
    <label for="name">Name:</label>
    <input type="text" name="name" />
    <>
    <div>
    <input type="submit" name="submit" value="Add Content" />
    </form>
<>
<img src="../images/bottom_box.png" width="840" height="40" />
<>
<>

<>

[/php]

what format are you using in the database row for the date?

if your using a date format then the reason it’s not working is it’s in the wrong format date needs to be in the format of YYYY-MM-DD for it to be stored otherwise it will store 0000-00-00

Sponsor our Newsletter | Privacy Policy | Terms of Service