Avatar of Aleks
Aleks
Flag 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.
ASPWeb DevelopmentHTML

Avatar of undefined
Last Comment
Big Monty

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Big Monty

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
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.
Big Monty

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")
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes