I am trying to do some very simple form validation checking for null or ” (empty) using a conditional, but when I submit my form with ALL BLANK FIELDS, it does the latter section of my code.
And when I fill out all of my fields it does that other part. So when they are blank, tell the user, which is the first section of the conditional, I have pasted my code below. Any suggestions on what I can do? Is it my ‘OR’ or ‘AND’
if(((f_name <> null) or (f_name <> '')) or ((l_name <> null) or (l_name <> '')) or ((username <> null) or (username <> '')) or ((password <> null) or (password <> ''))) then 'response.redirect('account_created.asp') response.write('You have not filled in all fields.') else Set objConn = ConnectDB() query = 'INSERT INTO [user] (username,[password],f_name,l_name) VALUES (''& username &'',''& password &'',''& f_name &'',''& l_name &'')' Set objs = objConn.Execute(query) response.write(query) 'Response.Redirect ('thankyou.asp') end if
1 Answer