ASP variable issue

My current code looks similar to this:
<input type="hidden" name="ppemail" value="<%=ngUserInfo.item("PPEmail")%>" />
Now, what I want to do is make it so if they do not have the PPEmail in their user information, that it will just pull their email address.
I thought the ASP code would look like this:
<%=
if ngUserInfo("PPEmail") = "" then
ngUserInfo.item("EmailAddress")
else
ngUserInfo.item("PPEmail")
end if      
%>
Clearly I was wrong.
Do note that I'm not very experienced in ASP code, I know just enough to get by.
ZodkaAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Wayne BarronAuthor, Web DeveloperCommented:
Run this, and let me know what error you receive?

<%=if ngUserInfo("PPEmail") = "" then%>
<%=ngUserInfo("EmailAddress")%>
<%else%>
<%=ngUserInfo("PPEmail")%>
<%end if%>

Open in new window


Carrzkiss
0
ZodkaAuthor Commented:
Microsoft VBScript compilation error '800a03ea'

Syntax error

/quick3.asp, line 122

Response.Write(if ngUserInfo("PPEmail") = "" then)
---------------^
0
Wayne BarronAuthor, Web DeveloperCommented:
Opps.
Sorry about that.

<%if ngUserInfo("PPEmail") = "" then%>
<%=ngUserInfo("EmailAddress")%>
<%else%>
<%=ngUserInfo("PPEmail")%>
<%end if%>

Open in new window


Forgot to remove the =, from your code, when I wrote it.
Sorry about that.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ZodkaAuthor Commented:
Thanks a lot, you just saved my project for the week
0
Wayne BarronAuthor, Web DeveloperCommented:
Not a problem.
What was happening, is that you was not writing the record out to the page.
Which is the reason why it was not working.

There are 2 ways of writing the records to the page.

#1. (This is the way I mainly write it)
<%=rs("recordname")%>

#2. (This is what a lot of people use, but it is a waste of time really, it is only really useful in certain circumstance.
<%=response.write rs("recordname")%>

I have a Knowledge Base, that you might find helpful
http://kb.cffcs.com (CFF Knowledge Base)

Also, I have a coding source site, that you might find to be very helpful as well.
http://www.cffcs.com (CFF Coding Source)

Take Care Zodka
Carrzkiss

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.