Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Validation

Status
Not open for further replies.

gcoleman1

Technical User
Mar 20, 2018
5
US
I know this is rather elementary for the bulk of you, but its not soaking into my brain.

I have a form with a field that the person has an option to fill out or not. I want to pass the value they input and if they don't input something I want to be able to assign a value to pass.

Something like if the variable is empty then assign the word "Anonymous" and pass that value, otherwise pass.

For example

If variable name "name" is not filled out by the user then
assign "Anonymous" to the variable name,
else if the variable name "name" was filled out by the user then pass that.

I have to do this kind of programming once every 10 years, so its certainly not second nature to me. Thank you for any resources you can suggest.
 
If Request.form ("email") = " " Then
Request.form ("email") = "webmail@xxxxxxxx.org"
Else useremail = Request.Form ("email")
End If
 
How about this:
Code:
useremail = Request.Form("email")
If useremail = "" Then useremail = "webmail@xxxxxxxx.org"

Also, since this appears to be Classic ASP, you may be better off posting in forum333.
 
Thank you! I will try the other forum. It didn't work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top