Learning ASP

Discussion in 'Software' started by NeoNemesis, Sep 29, 2004.

  1. NeoNemesis

    NeoNemesis Moutharrhea

    Alright in my attempt to learn a new web language since I only know html right now, im trying to learn ASP. I've got the basics down almost like writing text to the screen and stuff. The other stuff like forms I need to look at my reference code for. But anyways, I've been using a www.w3schools.com which I got from kodo a while ago. and btw it is an amazing site for learning a web language on. They are very good. I recommend them. But back to the problem. I i'm looking for another such site that has some other examples. I need small ones though like maybe how to make to a poll or something. Something simple that I can work off of and customize because that seems like the best to learn for me.
     
  2. Kodo

    Kodo SNATCHSQUATCH

  3. NeoNemesis

    NeoNemesis Moutharrhea

    ROFL I knew you would be the first to respond lol. I bet you were like, "OOhh, ASP, thats totally me!" lol.
     
  4. NeoNemesis

    NeoNemesis Moutharrhea

    Does anyone by chance have any ebooks for learning asp for absolute beginners they could email me? i found that they can help out a lot.
     
  5. goldfish

    goldfish Lt. Sushi.DC

    Wrox ASP 3.0 Beginners or ASP.NET Beginners books are a good book to start you off.

    If you know VB/VBScript you've got a headstart :)
     
  6. NeoNemesis

    NeoNemesis Moutharrhea

    I've heard a lot about asp.net. whats the difference between asp and asp.net?
     
  7. NeoNemesis

    NeoNemesis Moutharrhea

    Alright I've got my first stumper and definitely not my last. I'm trying to experiment to get the hang of things and I'm trying to make a form so that the user puts in there name, clicks the submit button (all on an html page) and then that brings them to the asp page where the data is saved in a cookie and if its the person's first visit it says "Welcome, this is your first time visiting" whereas if the person has been to the site before and it recognizes the cookie it says "Welcome Back" and then there name. I"m having trouble taking the variabel from the html form and printing it out through the cookie. Heres what I got so far.

    <body>
    <%
    dim firstname
    response.cookies("firstname")
    firstname=request.cookies("firstname")

    if firstname="" then
    response.cookies(request.form ("fname") ("firstname"))
    else
    response.write("Hello and welcome back "& firstname)
    end if
    %>
    </body>
     
  8. NeoNemesis

    NeoNemesis Moutharrhea

    Anyone?
     
  9. Kodo

    Kodo SNATCHSQUATCH

    <%if request.cookies("fname")<>"" then
    response.write ("WELCOME BACK!") & "request.cookies("fname")
    else
    Dim FirstName: FirstName=request.form("firstname")
    response.cookies("fname")=FirstName
    response.write ("Welcome "& request.cookies("fname")
    end if
    %>
     
  10. NeoNemesis

    NeoNemesis Moutharrhea

    Thanks Kodo, I realized what I had done wrong. I used this code:

    <%if request.cookies("fname")<>"" then
    response.write ("Welcome back " & request.cookies("fname"))
    else
    Dim FirstName: FirstName=request.form("firstname")
    response.cookies("fname")=FirstName
    response.write ("Welcome "& request.cookies("fname"))
    end if
    %>

    I think the best way to learn is to learn by example so thats why I'm just trying to do these things. Thanks again.
     
  11. Kodo

    Kodo SNATCHSQUATCH

    As long as you understand what mistakes you made, then my work here is done ;)
     
  12. NeoNemesis

    NeoNemesis Moutharrhea

    Alright I've come across another question and i can't seem to find the answer anywhere on the internet. I've seen that many websites have multiple pages built into one asp page. THey use asp and html combined which i know how to do already but my question is how do you make it like clear the screen and go to another part of the page. I have a log in page where you log in and then I want it to get rid of everything on the screen and show soemthign else farther into the page like "welcome or something". But so far it shows all the text from the whole page. Is there a way I can use subs like in basic or something in asp or html to only show one part at a time.

    Here is what I got so far:

    http://m.1asphost.com/DesmondP/index.asp

    And this is all my code so far:

    <html>
    <div align="center"><img src="image.php.gif"><br>Hello, Welcome to My ASP Website</div>
    <br><br>

    Please begin by telling me your name and password.
    <form method="post" action="index.asp">
    <input type="text" name="firstname" value="<%response.write(""& request.cookies("fname"))%>"><br>
    <input type="password" name="pass">
    <input type="submit" value="Continue">
    </form>
    <br>
    <font size="-1">If you have already logged in on this computer then just click submit</font>
    </html>
    <%
    if request.cookies("fname")<>"" then
    response.write ("Welcome back " & request.cookies("fname"))
    else
    Dim FirstName: FirstName=request.form("firstname")
    response.cookies("fname")=FirstName
    response.write ("Welcome "& request.cookies("fname"))
    end if
    dim password: password=request.form("pass")
    if password="nvde2h" then
    response.write("Master has arrived")
    else
    response.write("You aren't Desmond")
    end if
    %>
    <html>
    <br><br>
    This site is just for me to experiment with ASP, so it will always be changing.
    <br>
    </html>
     
  13. Kodo

    Kodo SNATCHSQUATCH

    look up case statements.
     
  14. animatorStrike

    animatorStrike <a href="http://www.acrodata.com/fun/waaa.jpg">Rid

    That code's lookin mighty sweet, Neo. Keep it up. :)
     
  15. NeoNemesis

    NeoNemesis Moutharrhea

    Thanks, i've been just learning different aspects and commands like if then else, and cookies and stuff and combining to make one big thing. so far this is basically what i know after two days of studying.

    Kodo: I thought it had something to do with the the conditional statements but i wasn't sure. Sometimes i think and think and then the answer turns out to be something i already know. It just seemed too simple to be right. Thanks.
     
  16. Kodo

    Kodo SNATCHSQUATCH

    case statements ARE conditional. Look em up..
     
  17. NeoNemesis

    NeoNemesis Moutharrhea

    yeah... oh and i figured that since for what im doing its easier if i use subs so thats what im using right now. it seems easier for what im doing. later on though if i do something like a menu or something i can see case being easier.
     
  18. NeoNemesis

    NeoNemesis Moutharrhea

    Now that i've learned how to use the case statement, how do I call it? I know how to use like drop down menus in HTML to use it with, but say I want to make a menu with links at the top, how would I link the menu to a certain case?
     
  19. Kodo

    Kodo SNATCHSQUATCH

    you can tie subs into that..

    for instance..

    menu=request.form("menutype")


    select case menu

    case "menu1"

    menusub1

    case "menu2"

    menusub2

    end select


    sub menusub1
    'links
    end sub

    sub menusub2
    'links
    end sub
     
  20. NeoNemesis

    NeoNemesis Moutharrhea

    How would I make a value for a link so that I could request it?
     
  21. Kodo

    Kodo SNATCHSQUATCH

    lets say you have a drop down on a form and you submit that form to the page with the case statements..

    dropdownvalue=request.form("dropdownformitemname")

    select case dropdownvalue

    ..etc...
     
  22. NeoNemesis

    NeoNemesis Moutharrhea

    No I mean like a link like a regular <a href="blahblahblah"><a/>. Cant you link from that?
     
  23. Kodo

    Kodo SNATCHSQUATCH

    I guess I don't understand what your final goal is..
     
  24. NeoNemesis

    NeoNemesis Moutharrhea

    im not really making antying im just seeing if it can be done for future reference. Lets say I wnated to make a page about me.

    I would want to have a menu at the top with links to other things. Normally you have links to other pages like "me.html" and "hobbies.html". But I want to put that into one page. I know you can do it with drop down menus and forms becuase you can use the case thing. But say I didn't want to use the drop down menu for my menu, i wanted to make a sidebar or something with links to other sections of my website. So one link may be something like "About me" and then it would go to a part of the script that says something about me. And another link may be "My Hobbies", and that would go to another part of the script. DO you get what im saying? I'm beginningt o think that it can't be done now that I think of it, but i can swear I've seen other websites do it. I just want to make my site more organized instead of having one page for each thing. YOu know?
     
  25. Kodo

    Kodo SNATCHSQUATCH

    again.. case statements will do this trick..

    <a href="index.asp?p=aboutme">About me</a>
    <a href="index.asp?p=contact">Contact me</a>


    ----------------

    Dim rPage: rPage=request.querystring("p")

    select case rPage

    case "about"

    'your code here

    case "contact"

    'your code here

    end select
     
  26. NeoNemesis

    NeoNemesis Moutharrhea

    Yeah i knew it was the case statement but I wasn't sure how I would use it with links. Thank you so much that really helped out a lot.
     
  27. NeoNemesis

    NeoNemesis Moutharrhea

    Hmm... now that I punch that in there, that doesn't seem to do the trick either. its still showing the links from the main page. When I click test1 it says "test1" but next to it is the link for it from before. maybe its just not possible lol.
     
  28. Kodo

    Kodo SNATCHSQUATCH

    pose your code.. surround with the PHP tags in the post please.
     
  29. NeoNemesis

    NeoNemesis Moutharrhea

    PHP:
    <html>
    <
    br>
    <
    a href="test.asp?p=test1">About Me</a><br>
    <
    a href="test.asp?p=test2">Test</a>
    </
    html>
    <%
    dim rpagerpage=request.querystring("p")
    select case rpage
    case "test1"
    response.write("hello")
    case 
    "test2"
    response.write("testing")
    end select
    %>
    Wait! is there a way to declare the variables before the HTML and make the HTML section a whole other Case? because that would work also.
     
  30. Kodo

    Kodo SNATCHSQUATCH

    ok dude.. I am completely confused as to what you want to do .. aside from your cases being outside the HTML (which it shouldn't be) .. I just can't put my head around what you want to do.
     
  31. NeoNemesis

    NeoNemesis Moutharrhea

    LOL Sorry for being so confusing but I solved my problem.

    What I did is slightly different because I had to link to a main case from a different page. THe reason that it wasn't working before is that it would always show somethign like this on the first thing with the links:

    About Me
    Testing

    And then when you clicked on one of thsoe it always went soemthing like this:

    About Me
    TestingHello I'm desmond

    See how it still showed the links from before? Well it was supposed to only say "Hi I'm desmond when I clicked one of the links. But sicne I had the links a whole case by themselves, it got rid of that and just displayed "Hello I"m desmond" kind of like having multiple web pages. NOrmally web pages dont show what you saw on the last page, instead it refreshes and theres new content. Well thats what I was getting to with this one. Hope im not confusing you to much. You can check out how I finally got it working here:
    http://m.1asphost.com/DesmondP/index.asp

    Then click on Case Statement Page at the bottom to go to what I wanted.
     
  32. Kodo

    Kodo SNATCHSQUATCH

    OOOH!! ok, I got ya now.. I was cornfused because I didn't realize you wanted to eliminate the links from displaying after they were clicked. Glad you got it sorted out though....that's the best way to learn ;)
     
  33. NeoNemesis

    NeoNemesis Moutharrhea

    Yeah I thought about how you said to put the stuff in the HTML and I was like, thats hwo I can make the html a case! lol. Yeah this should really help eliminate the need for a page for each thing. Thanks.
     
  34. Adrynalyne

    Adrynalyne Guest

    /slight hijack

    What is the advantage of asp over php?
     
  35. Kodo

    Kodo SNATCHSQUATCH

    one could ask the opposite, but I'd have to say that COM is a big plus on ASP's side. I could use a component that is a compiled DLL on my server that offers me an object to manipulate.
     
  36. NeoNemesis

    NeoNemesis Moutharrhea

    Eh this more or less turning into a general ASP thread. and i dont mind because it has to do with ASP so i can learn from it. ;)
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds