问题描述:

I'm trying to pass values from 2 drop down menus from a submit button using request.form.

The values i'm trying to pass are datetimes that come from SQL show below:

 <select name="startshift" id="startshift">

<%

While Not oRSShifts.EOF

response.Write("<option value=" & ORSShifts("Shift_Start_Time") & "> " & ORSShifts("Shift_Start_Time") & " </option>")

oRSShifts.MoveNext

WEND

%>

</select>

TO:

<select name="endshift" id="endshift">

<%

oRSShifts.MoveFirst

While Not oRSShifts.EOF

response.Write("<option value=" & ORSShifts("Shift_End_Time") & "> " & ORSShifts("Shift_End_Time") & " </option>")

oRSShifts.MoveNext

WEND

%>

</select>

When the submit button is pressed i use the ASP below to collect the values:

strstartshift = Request.Form("startshift")

strendshift = Request.Form("endshift")

The problem I'm having is, the correct value in the drop down list is for example: 01/01/2014 07:00:00 however the value that is collected by request.form is 01/01/2014 leaving out the time.

Any help appreciated.

Thanks

网友答案:

The date/time value has a space, so it needs to be included in quotes in order to be passed correctly as a form value. Try:

response.Write("<option value='" & ORSShifts("Shift_End_Time") & '">")
相关阅读:
Top