Jump to content

Multiple variables in ASP files

Recommended Posts

Hi, Can I put multiple variables in an ASP file? For instance: <html><body><%dim namefilter this list name="Donald Duck"response.write("My name is: " & name)%><%dim namefilter that list name="Darkwing Duck"response.write("My name is: " & name)%></body></html>I am using ASP files, Javascript, HTML and my database is MS SQL. Thanks for any help you can offer. tyv

Link to post
Share on other sites
Hi, Can I put multiple variables in an ASP file? For instance: ...
Yes you can, but not more than once with the same name! A variable declaration is global in your page (unless withina function). So in your example you would either need to reuse the same variable without declaring it again:
<%dim namename="Donald Duck"response.write("My name is: " & name)%><%name="Darkwing Duck"response.write("My name is: " & name)%>

or alternatively, in cases where you need a separate variable, declare it with a different name:

<%dim namename="Donald Duck"response.write("My name is: " & name)%><%dim name2name2="Darkwing Duck"response.write("My name is: " & name2)%>

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...