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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert into Request.form field when empty

Status
Not open for further replies.

gcoleman1

Technical User
Mar 20, 2018
5
US
Hello all.

I have a rather simple form that has two fields that are optional. When the form field is not filled out on the form I want a certain word to be put there instead. The variable name is useremail and right now I have coded the following:

If useremail = " " Then
useremail = "webmaster@xxxxx.org"
else useremail = Request.Form ("email")
end If
But when the form is submitted it still doesn't insert webmaster@xxxxx.org.

I only do this once every 10 years so I'm not versed in this at all. Thank your for any direction you can give!

Gale
 
Original thread is here: thread329-1785479

There is nothing wrong with the code I provided in the other thread (which I copied below), at least based on the very limited information and code you have provided so far.

Code:
useremail = Request.Form("email")
If useremail = [highlight #FCE94F]""[/highlight] Then useremail = "webmail@xxxxxxxx.org"

>But when the form is submitted it still doesn't insert webmaster@xxxxx.org.

Does it work when an email address IS entered on the form, and only fails to insert 'webmaster@xxxxx.org' when the field is empty? If so, notice that I do not have a blank space in between the two double-quotes (which I highlighted), whereas your code does, which could be the cause of your problems.

If this still does not work you will need to provide more code, not just that small snippet.
 
AWESOME!! I put a space in between "". Took it out and its perfect. Thank you!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top