Guest_imported
New member
- Jan 1, 1970
- 0
I was entering data via a form into the database. I couldn't use apostrophes because everything after the apostrophe was chopped off. I got a bit of code to sort that out but now I can't add " into any of the form fields as everything after the " is chopped off. Any ideas how the code below can be modified to sort this out?
Many thanks
James
' now we'll set up the form for submitting to the database
response.write "<tr><td colspan=2>"
response.write "<p><br><form method='post' action='add.asp'>"
For each road in request.form
If road="Flag" then
response.write "<input type='hidden' name='"
response.write road & "' value=2>"
Else
response.write "<input type='hidden' name='"
response.write road & "' value=" & chr(34)
response.write request.form(road) & chr(34)
response.write "'>"
End If
Next
' now give the user the buttons to click on
' note the Modify button uses a snippet of javascript
response.write "<input type='submit' value='Submit Information'>"
response.write " "
response.write "<input type='button' value='Modify Information' onclick=history.go(-1)>"
response.write "</form></td></tr></table>"
response.end
End If
Case 2
' this is where the information finally gets submitted to the database
road = request.form("road"
area = request.form("area"
postcode = request.form("postcode"
weekly_rental = request.form("weekly_rental"
number_bedrooms = request.form("number_bedrooms"
location = request.form("location"
furnished = request.form("furnished"
list_text = request.form("list_text"
detail_text = request.form("detail_text"
imageone = request.form("imageone"
imagetwo = request.form("imagetwo"
Function QS(strIn)
QS = Replace(Trim(strIn & "", "'", "''"
If Len(QS) = 0 Then
QS = "Null"
Else
QS = "'" & QS & "'"
End If
End Function
set conn = server.createobject("adodb.connection"
conn.open "property"
SQLstmt = "INSERT INTO details " & _
"(road,area,postcode,weekly_rental," & _
"number_bedrooms,location,furnished," & _
"list_text,detail_text,imageone,imagetwo) " & _
"VALUES (" & _
QS(road) & "," & _
QS(area) & "," & _
QS(postcode) & "," & _
QS(weekly_rental) & "," & _
QS(number_bedrooms) & "," & _
QS(location) & "," & _
QS(furnished) & "," & _
QS(list_text) & "," & _
QS(detail_text) & "," & _
QS(imageone) & "," & _
QS(imagetwo) & ""
Set RS = conn.execute(SQLstmt)
Many thanks
James
' now we'll set up the form for submitting to the database
response.write "<tr><td colspan=2>"
response.write "<p><br><form method='post' action='add.asp'>"
For each road in request.form
If road="Flag" then
response.write "<input type='hidden' name='"
response.write road & "' value=2>"
Else
response.write "<input type='hidden' name='"
response.write road & "' value=" & chr(34)
response.write request.form(road) & chr(34)
response.write "'>"
End If
Next
' now give the user the buttons to click on
' note the Modify button uses a snippet of javascript
response.write "<input type='submit' value='Submit Information'>"
response.write " "
response.write "<input type='button' value='Modify Information' onclick=history.go(-1)>"
response.write "</form></td></tr></table>"
response.end
End If
Case 2
' this is where the information finally gets submitted to the database
road = request.form("road"
area = request.form("area"
postcode = request.form("postcode"
weekly_rental = request.form("weekly_rental"
number_bedrooms = request.form("number_bedrooms"
location = request.form("location"
furnished = request.form("furnished"
list_text = request.form("list_text"
detail_text = request.form("detail_text"
imageone = request.form("imageone"
imagetwo = request.form("imagetwo"
Function QS(strIn)
QS = Replace(Trim(strIn & "", "'", "''"
If Len(QS) = 0 Then
QS = "Null"
Else
QS = "'" & QS & "'"
End If
End Function
set conn = server.createobject("adodb.connection"
conn.open "property"
SQLstmt = "INSERT INTO details " & _
"(road,area,postcode,weekly_rental," & _
"number_bedrooms,location,furnished," & _
"list_text,detail_text,imageone,imagetwo) " & _
"VALUES (" & _
QS(road) & "," & _
QS(area) & "," & _
QS(postcode) & "," & _
QS(weekly_rental) & "," & _
QS(number_bedrooms) & "," & _
QS(location) & "," & _
QS(furnished) & "," & _
QS(list_text) & "," & _
QS(detail_text) & "," & _
QS(imageone) & "," & _
QS(imagetwo) & ""
Set RS = conn.execute(SQLstmt)