Sorrow Posted September 29, 2008 Share Posted September 29, 2008 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 https://forums.phpfreaks.com/topic/126364-dates/ Share on other sites More sharing options...
trq Posted September 29, 2008 Share Posted September 29, 2008 Do you actually have any form tags? Link to comment https://forums.phpfreaks.com/topic/126364-dates/#findComment-653463 Share on other sites More sharing options...
Barand Posted September 29, 2008 Share Posted September 29, 2008 The selects and submit button need to be inside form tags and your first select is incorrectly formatted (options have value, not the select) Link to comment https://forums.phpfreaks.com/topic/126364-dates/#findComment-653468 Share on other sites More sharing options...
Sorrow Posted September 29, 2008 Author Share Posted September 29, 2008 yes i have the form tags and i modified the select tag also but still not working Link to comment https://forums.phpfreaks.com/topic/126364-dates/#findComment-653470 Share on other sites More sharing options...
PFMaBiSmAd Posted September 29, 2008 Share Posted September 29, 2008 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 https://forums.phpfreaks.com/topic/126364-dates/#findComment-653472 Share on other sites More sharing options...
Sorrow Posted September 29, 2008 Author Share Posted September 29, 2008 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 https://forums.phpfreaks.com/topic/126364-dates/#findComment-653474 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.