SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Jan 2012
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    insert drop down list (date) into database

    hi, i have drop down list called check in date.

    Code:
    Check-in Date :
    	<select name="inmonth" id="inmonth">
    	<option value="-1">Month</option>
    	<option value="0">January</option>
    	<option value="1">February</option>
    	<option value="2">March</option>
    	<option value="3">April</option>
    	<option value="4">May</option>
    	<option value="5">June</option>
    	<option value="6">July</option>
    	<option value="7">August</option>
    	<option value="8">September</option>
    	<option value="9">October</option>
    	<option value="10">November</option>
    	<option value="11">December</option>
    	</select>
    			&nbsp;
    			<select name="indate" id="indate">
    			<option value="-1">Date</option>
    			<option value="0">1</option>
    			<option value="1">2</option>
    			<option value="2">3</option>
    			<option value="3">4</option>
    			<option value="4">5</option>
    			<option value="5">6</option>
    			<option value="6">7</option>
    			<option value="7">8</option>
    			<option value="8">9</option>
    			<option value="9">10</option>
    			<option value="10">11</option>
    			<option value="11">12</option>
    			<option value="12">13</option>
    			<option value="13">14</option>
    			<option value="14">15</option>
    			<option value="15">16</option>
    			<option value="16">17</option>
    			<option value="17">18</option>
    			<option value="18">19</option>
    			<option value="19">20</option>
    			<option value="20">21</option>
    			<option value="21">22</option>
    			<option value="22">23</option>
    			<option value="23">24</option>
    			<option value="24">25</option>
    			<option value="25">26</option>
    			<option value="26">27</option>
    			<option value="27">28</option>
    			<option value="28">29</option>
    			<option value="29">30</option>
    			<option value="30">31</option>
    			</select>
    	&nbsp;
    	<select name="inyear" id="inyear">
    	<option value="0">Year</option>
    	<option value="2012">2012</option>
    	<option value="2013">2013</option>
    	<option value="2014">2014</option>
    	<option value="2015">2015</option>
    	<option value="2011">2016</option>
    	</select>
    i want to how to insert the check-in date as a short date (example : 1/4/2012) into the access database? i kinda know the syntax, but not quite. please help!

  2. #2
    SitePoint Wizard bronze trophy
    Join Date
    Oct 2001
    Location
    Vancouver BC Canada
    Posts
    2,037
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)

    Talking

    You're going to have to tweak the code a bit for your purposes but you're SQL will look a little like this:

    * I've only covered inserting the date so you'll have to fill in the rest of the fields as required. I'm also not sure if you're using GET or POST so I've used the ambiguous Request() method to grab the variables... You can change it to Request.Form() or Request.QueryString() if it suits your needs.

    Code:
    <%
    
    check-in-date = Request("inmonth") & " " & Request("indate") & ", " & Request("inyear")
    strQuery = "INSERT INTO Your-Database-Table(check-in-date) VALUES ('"&posting&"')"
    
    %>
    Andrew Wasson | www.lunadesign.org
    Principal / Internet Development


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •