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?
 
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
 
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
 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.