First of all i'm a newbie so bear with me...
I have created a form in which people submit a phonebumebr to a database, curently if they put a space in there it throws up an error.
I have been told that :
Never insert unsanitized data into your database.
Always validate submitted form data
If your field is a number then that's your problem. Use Replace() to remove the spaces in the variable.
My field number is text
Here is my code:
<%
'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim strSQL 'Holds the SQL query to query the database
'Create an ADO connection object
Set adoCon = Server.CreateObject("ADODB.Connection")
'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("../../db/faxremove.mdb")
'Create an ADO recordset object
strSQL = "INSERT INTO tblComments (FaxNumber) VALUES (" & Request.Form("FaxNumber") & ")"
adoCon.Execute strSQL
Set adoCon = Nothing
'Redirect to the guestbook.asp page
Response.Redirect "default2.asp"
%>
can anyone advise me what I need to do?