I'm having a hard time thinking of a way to make a form for events.php(User adds an event by inputting Event Name and Event Date)

I have made a table "Events";
with Fields
1. EventID int
2. EventName varchar
3. EventDate Date---->this is the problem mysql uses Year-Month-Day format. I want it to be ex. January 29 1993. but before that Im wondering if theres a way for a calendar to show when you click the input text of Event Date on my form..then in turn when submitted, it will be inserted into my table

Member Avatar for diafol

This is what a js widget can do for you like a jqueryui datepicker. You decide on the "form format". You can use a variety of functions to convert that to the desired DB format. DO NOT store DB format as "January 29 1993" - always try to store as Y-m-d - as this can be used to sort easily and if you need to filter - it's easy enough with BETWEEN ... AND ...

Thanks sir...But I cant seem to get it to insert on my database..it gives 0000-00-00

<?php //include config

require_once('../includes/config.php'); 
//if not logged in redirect to login page
if(!$user->is_logged_in()){ header('Location: login.php'); }
?>
<!doctype html>
<html lang="en">
<head>
 <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
<title>Add-Event</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
<script>
$(function() {
$( "#datepicker" ).datepicker({dateFormat : 'yyyy-mm-dd'});

});
</script>
 <link href="../css/bootstrap.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="../css/sics.css">
   <style type="text/css">
    #usernav .drop {
      color: black;
    }
  </style>  
</head>
<body>
<div id="wrapper">

      <?php include("../includes/topnavbar.php");?>

        <!-- Page content -->
        <div id="page-content-wrapper">
             <div class="row">
                        <div class="col-md-4 col-md-offset-3 area">
                            <div class="col-md-12 content-area">
                                <form role="form" action='' method='POST'>
                                  <div class="form-group"><br><br><br>

                                    <p>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspEvent Title:<input type='text' name='EventTitle' class="form-control col-md-offset-4" value='<?php if(isset($error)){ echo $_POST['catTitle'];}?>'></p><p>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspDate: <input name="datepicker" class="form-control col-md-offset-4" type="text" id="datepicker"></p>
                                     <input type="submit" name="submitevent" class="btn btn-primary  col-md-offset-4 "value="Submit Event"><br><br/>
                            <a href="/sics/users/MainPanel.php"><input type='button' class="btn btn-primary  col-md-offset-4 " value='Back'></a>
                                  </div>

                            </div>
                        </div>
                    </div>



                                <?php
                                    include('../includes/submitevent.php');
                                ?>      

                </div><!-- content -->

            </div>


        </div><!--page-content-wrapper-->

    </div>
    <br><br><br><br><br><br><br><br><br>
     <div id="content-3">
    <p class="text-center"></br><a href=""><img src="../img/webicon-facebook-m.png"></a> &middot <a href=""><img src="../img/webicon-twitter-m.png"></a></br></p>
  </div>
    <div class="footer container">
  </br>
  </br>
  <p class="pull-right"><a href="#">Back to top</a></p>
  </br>
  <p class="text-muted">&copy; 2014 School of Information Technology and Computing Sciences &middot; </p>
</div>

</body>
</html>
Member Avatar for diafol

Noticed this was solved? Is it?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.