Redirect to another webpage

Miscellaneous Forums/General Discussion/Redirect to another webpage

Hiya. Is there an easy way to redirect a user to another webpage instantly?

Basically I'm wanting to do this:

- The user clicks a button on my page (could just be a normal image)
- it goes to another normal HTML page that I can embed some google tracking script on.
- The the page then calls a paypal shopping cart button useing the Form Action etc that a normal button would if the user clicked in on the first page.

Is that possible?

Maybe I'm not explaining it very well. I have a page with a form button on which has the paypal shopping cart code. But in order to track who clicks it, I need a simple button to lead to another page with some google script on which then automatically calls the Form Action code for the Paypal button.

Yes I know I could write some php script that tracked clicks on the Paypal button on the first page, but actually I need it to go to a separate page because I use adwords and google can tell me which Key words led to a click of the button, this is very valuable information!

Thanks for any help!

Can do it easily with PHP:
<?php
 header("Location: http://www.yoursite.co.uk/yourpage.php");
 ?>

You don't need an absolute path - its just an example. I'm sure you can fill in the blanks. ;)

OK cool. So the page has to be .PHP not .HTML. I'll have to try this and check that the google java script still gets called.

No you can redirect to anything - even an EXE.

You can use javascript too. But if a user has javascript disabled, they'll end up stuck on a blank / interim page.

OK so php is safer. Thanks.

Heres some sites i learned basic php from:

phpfreaks.com (or .net?)
php.com (or .net?)


Theres lots of examples and code bits one them. Thats how i learned the basics.

I use php.net

Grey Alien, i have written in PHP a PayPal module that allows you to do all this using a single function.
Its a bit hard to explain, but its very easy to use.

[edit]
after reading your post again i toughd, lemme help you on that:

<form name="frmOrder" id="frmOrder" action="www.yourwebsite.com/yourpage.php" method="post">
put your HTML here and the info to be submited.
<input name="mybutton" id="mybutton" type="button" value="Click here" onClick="document.frmOrder.submit();">
</form>

or incase you dont want to submit info, just redirect...

<input name="mybutton" id="mybutton" type="button" value="Click here" onClick="window.location='www.yourwebsite.com/yourpage.php'">

then on page2 go like

<from name="mypaypalformwithsubmitbutton" id="mypaypalformwithsubmitbutton" method="post">
paypal stuff goes here....
</form>

at the bottom of the page just before </body></html>

<script language="javascript">
document.mypaypalformwithsubmitbutton.submit();
</script>

thats it.

if this does not work with FireFox (i haven't tested) use this:

document.getElementById("mypaypalformwithsubmitbutton").submit();

that is cross-browser.

interesting. Thanks.