1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

ASP equivalent Code to PHP ?

Discussion in 'C#' started by JohnMally, Aug 5, 2008.

  1. #1
    Hi Everyone,

    Would anyone know whats asp.net equivalent to the below script ?

    <?php echo $_GET['keyword']?>
     
    JohnMally, Aug 5, 2008 IP
  2. Sleeping Troll

    Sleeping Troll Peon

    Messages:
    217
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    <% Response.Write (Request.QueryString("keyword"))%>
     
    Sleeping Troll, Aug 5, 2008 IP
  3. JohnMally

    JohnMally Peon

    Messages:
    159
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hi,

    Thank you so much !

    Do you know if I would need to append this code at the end of my url so my visitors can view the "printed" keyword ?

    http://www.myinternetsite.com/index.asp?keyword={keyword}
     
    JohnMally, Aug 5, 2008 IP
  4. JohnMally

    JohnMally Peon

    Messages:
    159
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    JohnMally, Aug 5, 2008 IP
  5. JohnMally

    JohnMally Peon

    Messages:
    159
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    hi everyone,

    i tried the above code and it worked but my image and the {} around my keywords are showing. would anyone know why ?

    thanks for everyones time

    P.S. does anyone know how to edit the script so the the first letter of each keywor is in caps ?
     
    JohnMally, Aug 5, 2008 IP
  6. chrisn

    chrisn Peon

    Messages:
    54
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Remove the {} from the URL.

    If you only want the first letter caps and nothing else then

    <% 
    dim mykeyword
    
    mykeyword= Request.QueryString("keyword")
    
    mykeyword= UCase(Left(mykeyword, 1)) & LCase(Mid(mykeyword, 2))
    
    
    Response.Write (mykeyword)
    
    %>
    Code (markup):
    Or if you want the first letter caps and the rest exactly as it was entered remove the LCase statement.
     
    chrisn, Aug 6, 2008 IP
  7. JohnMally

    JohnMally Peon

    Messages:
    159
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Hi Chrisn,

    I really appreciate the help. I'm trying to get the second letter of the second word in caps. I add the "UCase (Mid(mykeyword, 2))" and everything becomes CAPS. I don't know why. Does anyone know what code it takes

    Also, for some reason my images on my landing page aren't showing. Everything is appearing as a "X". Is it possible to PM someone my URL. Perhaps you can take a look at it and tell me what you think. Why does anyone think this is the case ?

    Thanks,
    John
     
    JohnMally, Aug 6, 2008 IP
  8. chrisn

    chrisn Peon

    Messages:
    54
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Right second letter of the second word.

    I think I understand the question.

    I'm assuming you have the second word in a separate variable and not part of a string with a space between.

    The number in the mid command indicates the start position in the string, if you don't supply another number after it takes the full length of the string, if you do supply the optional value you can specify the length of the selection you want.

    So if my string is "chris" and I want it to become cHris I would use this code:

    
    <% 
    
    mykeyword2 = LCase(Left(mykeyword2, 1)) & UCase(Mid(mykeyword2, 2, 1)) & LCase(Mid(mykeyword2, 3))
    
    %>
    
    
    Code (markup):
    PM me the URL and I'll look at the images.
     
    chrisn, Aug 6, 2008 IP
  9. JohnMally

    JohnMally Peon

    Messages:
    159
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Hi Chris,

    I meant the first letter of each word.

    "Compare Car Insurance" the "CCI" are in caps. Thats what I want to do.

    I will PM you the urls. Thanks for your time. I appreciate your help.

    Thanks !
     
    JohnMally, Aug 6, 2008 IP
  10. chrisn

    chrisn Peon

    Messages:
    54
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #10
    OK, I have PMed you the fix for the images,

    Re capitalising every word, as you only have one keyphrase you need to split it up into words, use the split function to do this.

    <%
    Dim mykeyword
    Dim mykeywords
    
    mykeyword = Request.QueryString("keyword")
    mykeywords = Split(mykeyword, " ")
    
    
    For i = 0 To UBound(mykeywords)
       response.write UCase(Left(mykeywords(i), 1)) & LCase(Mid(mykeywords(i), 2))
        If Not i = UBound(mykeywords) Then response.write " "
    Next
    
    %>
    Code (markup):
     
    chrisn, Aug 6, 2008 IP
  11. JohnMally

    JohnMally Peon

    Messages:
    159
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    Hi,

    Thanks for the reply. I appreciate it. Will this code work when someone lands on my landing page from either yahoo, google and msn and they search for lets say "car insurance" will the phrase "car insurnace" be inserted onto the page ?
     
    JohnMally, Aug 17, 2008 IP