[SalesForce] Trouble passing multiple values from one page to another in URL

I'm trying to send a value from one page to another, I've tried adding it to my URL.

{!my_val} //Value is a simple string

<apex:outputLink value="/apex/NewPage?id={the_account.id}_myValue{!my_val}">
    <div class="link_class">
        <strong>Link</strong>
    </div>
</apex:outputLink>

But I have an Id at the end of my url and when I add my value, I get the following error:

Id value is not valid for the standard controller 

So I'm assuming the value is breaking the Id.

If I add it before my Id, Salesforce says it can't find my page, so it seems to be breaking my Url.

{!my_val}    

<apex:outputLink value="/apex/NewPage_myValue{!my_val}?id={the_account.id}">
    <div class="link_class">
        <strong>Link</strong>
    </div>
</apex:outputLink> 

Is there any way to pass my value through in my url?

UPDATE

Adding an ampersand seems to do the trick… Page loads and my value is appended to my Url with no errors.

<apex:outputLink value="/apex/NewPage?id={the_account.id}&myValue{!my_val}">
    <div class="link_class">
        <strong>Link</strong>
    </div>
</apex:outputLink>

Would anyone be able to tell me if this an acceptable solution?

Or are ampersands supposed to be avoided in Urls?

Best Answer

@Daft, I think you resolved your own question. When passing more than one varialbes in a url, you need to seperate them using ampersand (&).

single variable: http://myapp.test.com?var1=1

2 variables: http://myapp.test.com?var1=1&var2=2

Note that the url string should be encoded for the browser to parse it correctly.

Related Topic