How to add a form to a template

I'm successfully using a hook to override the add to cart buttons so different buttons are automatically used on the product page depending on certain criteria. That's working fine with no problems.

What I want to do now, is use a form button so it posts data to a particular page.

I tried using the form below to replace the button but it does not work:



It seems CS-Cart takes over the action and/or p[i]ost [/i]so it does not work like a regular form. When I hover over the submit button, it shows index.php in the title when it should be the page I have specified in the action. When the form button is clicked, it looks like it submits to index.php instead of the page I have specified in the form action.

I tried [i]get[/i] and got the same results.

How can I post data from this template to myPage.php when the button is clicked?

Must of had a brain f@rt…

I forgot about passing variables in the URL. That works just fine since the data is not sensitive so I don’t need to use a form after all. :rolleyes:

Spoke to soon. Passing variables in the URL works on some URL's but not others.

How can I pass URL's that contain “&” ?

What I have is a link on a product page. The link contains a variable for an external URL. When a customer clicks on the link, they are redirected to a page on my site that includes an iframe. The URL for the external site is passed to this page and the external page is opened in the iframe. It works on any URL that does not contain any “&”.

Here is the link with the variable:

Here's an example that fails:

Replacing the “&” with “&” or “%26” does not work.

I figured it out.

This works:

I do need to use a form to post some data. Can someone please read the first post in this thread and tell me how I can get this working?