Dragen Posted April 10, 2007 Share Posted April 10, 2007 Hi, I've got this form: <form name="adddates" method="post" action="editbooking.php"> <select name="day" size="1"> <option value="" selected="selected">day</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</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> <select name="month" size="1"> <option value="" selected="selected">month</option> <option value="1">Jan</option> <option value="2">Feb</option> <option value="3">Mar</option> <option value="4">Apr</option> <option value="5">May</option> <option value="6">Jun</option> <option value="7">Jul</option> <option value="8">Aug</option> <option value="9">Sep</option> <option value="10">Oct</option> <option value="11">Nov</option> <option value="12">Dec</option> </select> <select name="year" size="1"> <option value="" selected="selected">year</option> <option value="<?php echo date(Y); ?>"><?php echo date(Y); ?></option> <option value="<?php echo date(Y)+1; ?>"><?php echo date(Y)+1; ?></option> </select> <input type="submit" name="submit" value="submit" /> </form> as you can see I'm processing it through editbooking.php. editbooking.php contains the following: $day = $_POST['day']; $month = $_POST['month']; $year = $_POST['year']; mysql_query("INSERT INTO `booked` VALUES ('$day', '$month', '$year')"); echo "Your information has been successfully added to the database."; mysql_close($conn); note that the database connection stuff has not been included in this example, although it is in the actual file. When I submit my form it show the echo statement, so I presume it's worked, but if I check my database, nothing has been entered. Could it be because the databse values are int instead of varchar? thanks Quote Link to comment https://forums.phpfreaks.com/topic/46517-solved-error-insert-into-using-form/ Share on other sites More sharing options...
clown[NOR] Posted April 10, 2007 Share Posted April 10, 2007 you're not telling it where to insert the values... try this mysql_query("INSERT INTO booked (day, month, year) VALUES ('$day', '$month', '$year')"); http://www.w3schools.com/php/php_mysql_insert.asp Quote Link to comment https://forums.phpfreaks.com/topic/46517-solved-error-insert-into-using-form/#findComment-226397 Share on other sites More sharing options...
Dragen Posted April 11, 2007 Author Share Posted April 11, 2007 ah yes. thanks.. Just me being stupid as usual... Quote Link to comment https://forums.phpfreaks.com/topic/46517-solved-error-insert-into-using-form/#findComment-226398 Share on other sites More sharing options...
clown[NOR] Posted April 11, 2007 Share Posted April 11, 2007 hehe..it happens to the best Quote Link to comment https://forums.phpfreaks.com/topic/46517-solved-error-insert-into-using-form/#findComment-226399 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.