Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8642303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:44:26+00:00 2026-06-12T11:44:26+00:00

I can not seem to get the date to insert from my form into

  • 0

I can not seem to get the date to insert from my form into my data base. Please help!

here is my form

echo '

<h1>Enter New Report</h1>
<form action="submitreport.php" method="post"
enctype="multipart/form-data">

 Date: <input type="text" name="Date" value='.$myDate.' /><br />
 Report:<br><TEXTAREA NAME=Report ROWS=4 COLS=40></TEXTAREA><br />
 <input type="submit" name="submit" value="Submit" />
 </form>

 ';
 ?> 

Here is what I have written to submit it to the database

$insertdate = trim($_POST['Date']);

$insertdate = mysql_real_escape_string($insertdate);
    $insertdate = date('m/d/Y', $insertdate);

echo $insertdate;


mysql_query("INSERT INTO `Reports`(`Date`, `Report`) VALUES ('$insertdate','$_POST[Report]')") or die("load1 -" .  mysql_error());


mysql_close();

echo "Thank You!" . " -" . "<a href='index.php' style='text-decoration:none;color:#ff0099;'> Return Home</a>";
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T11:44:27+00:00Added an answer on June 12, 2026 at 11:44 am

    I’m only guessing, but your Date field in the database is either of type date or datetime. The format of these are YYYY-mm-dd. Try changing your code to:

    $insertdate = date('Y-m-d', strtotime($_POST['Date']));
    

    Also, you aren’t converting the date to a timestamp before formatting it. I’ve added strtotime() on the data here as well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Am I not seeing something obvious here, can't seem to get this to work...
I cannot seem to get user entered data into a table and then printed.
Can anybody help me out, while my solution does not seem to work: $this->db->where('stock
I cannot seem to get this date picker working at all. I know it
I can't seem to get this right, I can get it to catch a
I have tried almost everything and I can't seem to get my lists to
I am trying to insert a row into a MySQL table and get it's
I am trying to get a Date type field from the entity and I
I've skimmed thru Date and Silberschatz but can't seem to find answers to these
I am trying to get some data stored in a database that i can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.