DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Problem using QueryString with ampersand in a link variable...

  1. #1
    Siri Guest

    Problem using QueryString with ampersand in a link variable...


    Hello,
    I have a link
    <a href="mypage.asp?f=<%=first%>&s=<%=sec%>">Donalds</a>
    where first and second is defined like
    <%
    first = "Donald & Co"
    sec = "2"
    %>

    When I use Querystring in mypage.asp to fetch the variables it looks like
    this:
    f=request.querystring("f")
    s=request.querystring("s")

    but when I look at the variables they just look like

    f=Donald
    s=

    i e I have lost the information after my ampersand..
    How come??





  2. #2
    john Guest

    Re: Problem using QueryString with ampersand in a link variable...


    Try this:

    <a href="mypage.asp?f=<%=first%>" & "&s=<%=sec%>">Donalds</a>


    "Siri" <siri.svedberg@capgemini.se> wrote:
    >
    >Hello,
    >I have a link
    ><a href="mypage.asp?f=<%=first%>&s=<%=sec%>">Donalds</a>
    >where first and second is defined like
    ><%
    >first = "Donald & Co"
    >sec = "2"
    >%>
    >
    >When I use Querystring in mypage.asp to fetch the variables it looks like
    >this:
    >f=request.querystring("f")
    >s=request.querystring("s")
    >
    >but when I look at the variables they just look like
    >
    >f=Donald
    >s=
    >
    >i e I have lost the information after my ampersand..
    >How come??
    >
    >
    >
    >



  3. #3
    Matthew Solnit Guest

    Re: Problem using QueryString with ampersand in a link variable...

    Try using the Server.URLEncode() function.



  4. #4
    Reza Guest

    Re: Problem using QueryString with ampersand in a link variable...


    Siri,
    John is close but that will not work
    if you are using it within a resopnse.write or redirect then you need this

    varURL = "Mypage.asp?f=" & first & "&S=" & Second & ">Donalds</A>"
    Response.write varURL

    if you want to switch contents then it would look like

    <a href="mypage.asp?f=<%=first%>&s=<%=sec%>">Donalds</a>

    I would suggest that you keep switching contents to a minimum there is to
    much processing switching back and forth.

    Thanks
    Reza

    "john" <jluciano@twtr.com> wrote:
    >
    >Try this:
    >
    ><a href="mypage.asp?f=<%=first%>" & "&s=<%=sec%>">Donalds</a>
    >
    >
    >"Siri" <siri.svedberg@capgemini.se> wrote:
    >>
    >>Hello,
    >>I have a link
    >><a href="mypage.asp?f=<%=first%>&s=<%=sec%>">Donalds</a>
    >>where first and second is defined like
    >><%
    >>first = "Donald & Co"
    >>sec = "2"
    >>%>
    >>
    >>When I use Querystring in mypage.asp to fetch the variables it looks like
    >>this:
    >>f=request.querystring("f")
    >>s=request.querystring("s")
    >>
    >>but when I look at the variables they just look like
    >>
    >>f=Donald
    >>s=
    >>
    >>i e I have lost the information after my ampersand..
    >>How come??
    >>
    >>
    >>
    >>

    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center