Link to home
Start Free TrialLog in
Avatar of Aleks
AleksFlag for United States of America

asked on

Append parameter to redirect

I am trying to redirect to another page after inserting a value

 ' append the query string to the redirect URL
    Dim MM_editRedirectUrl
    MM_editRedirectUrl = "parties_SPaddlinks.asp?NewUserId=<%=(rs_contact.Fields.Item('UserId').Value)%>"

Open in new window


But I am getting a syntax error. What would the correct syntax be ?

Using classic ASP.
ASKER CERTIFIED SOLUTION
Avatar of Big Monty
Big Monty
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Aleks

ASKER

It worked like this:

MM_editRedirectUrl = "parties_SPaddlinks.asp?NewUserId=" & (rs_contact.Fields.Item("UserId").Value)

I tried to add another parameter but my syntax did not work:

 MM_editRedirectUrl = "parties_SPaddlinks.asp?NewUserId=" & (rs_contact.Fields.Item("UserId").Value) & relation =" & Request("relation")

Open in new window


Sorry I should have asked with two parameters so I could add more later on if needed.
you're essentially concatenating a string, so your format should be:

varName = "some text" & aVariable & "some more text" & anotherVariable

you're missing a beginning quote on your second example, it should be:

MM_editRedirectUrl = "parties_SPaddlinks.asp?NewUserId=" & (rs_contact.Fields.Item("UserId").Value) & "relation =" & Request("relation")