Jump to content

Dates


Sorrow

Recommended Posts

Hello everyone, I have a little issue regarding lists and dates. I have 2 list, 1 for the month and 1 for the day. I am trying to pass the info to another page so I can save it into a database but it just never pass it.

 

Code from page 1:

Release Date :<td> Month
<select name='relMonth' value=''>Select Month</option>
<option value='01'>January</option>
<option value='02'>February</option>
<option value='03'>March</option>
<option value='04'>April</option>
<option value='05'>May</option>
<option value='06'>June</option>
<option value='07'>July</option>
<option value='08'>August</option>
<option value='09'>September</option>
<option value='10'>October</option>
<option value='11'>November</option>
<option value='12'>December</option>
</select>

Date 
<select name='relDate' >
<option value='01'>01</option>

<option value='02'>02</option>
<option value='03'>03</option>
<option value='04'>04</option>
<option value='05'>05</option>
<option value='06'>06</option>
<option value='07'>07</option>
<option value='08'>08</option>
<option value='09'>09</option>
<option value='10'>10</option>
<option value='11'>11</option>
<option value='12'>12</option>
<option value='13'>13</option>
<option value='14'>14</option>
<option value='15'>15</option>
<option value='16'>16</option>
<option value='17'>17</option>
<option value='18'>18</option>
<option value='19'>19</option>
<option value='20'>20</option>
<option value='21'>21</option>
<option value='22'>22</option>
<option value='23'>23</option>
<option value='24'>24</option>
<option value='25'>25</option>
<option value='26'>26</option>
<option value='27'>27</option>
<option value='28'>28</option>
<option value='29'>29</option>
<option value='30'>30</option>
<option value='31'>31</option>
</select>


Year(yyyy) <input type=text name='relyear' size=8 >


<td><td><input type='submit' align='right' value='Add Release'  />

 

And for the page 2

<?php
$DateRel = $_POST['relMonth'] $_POST['relDate'] ',' $_POST['relYear'];
include 'opendb.php';
$sql="INSERT INTO dvdRelease ( 'Release ID' , 'relTitle' , 'relDirector','relTrailer','relCase','relDate' )
VALUES ('$_POST[dvdTitle]','$_POST[dvdDirector]','$_POST[dvdTrailer]','$_POST[dvdCase]',$DateRel)
";

Link to comment
Share on other sites

The $DateRel = statement in the php code is syntactically incorrect (untested.) And you would need to be storing a date in a database using a DATE data type (yyyy-mm-dd) to be useful for searching or ordering the results.

 

And what exactly is the second page doing? There is no code to actually execute a query in the posted code.

Link to comment
Share on other sites

tru that lol sorry secod page code is

<?php
$DateRel = $_POST['relMonth'] $_POST['relDate'] ',' $_POST['relYear'];
include 'opendb.php';
$sql="INSERT INTO dvdRelease ( 'Release ID' , 'relTitle' , 'relDirector','relTrailer','relCase','relDate' )
VALUES ('$_POST[dvdTitle]','$_POST[dvdDirector]','$_POST[dvdTrailer]','$_POST[dvdCase]',$DateRel)
";

if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  }
echo "1 Release added";

mysql_close($con)
?>

 

everything is working fine except for the date.And how would I be able to do that

to be storing a date in a database using a DATE data type (yyyy-mm-dd) to
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.