View Full Version : How to insert javascript variable into form redirect

Nov 10th, 2006, 12:52 AM
Hi, I am a new guy here but wondering if anyone can help. I need to redirect users to a page based on the valua of a variable. ie if the variable is "widgit.com/moreinfo1.htm" then they get rediected there. The variable changes based on several onclicks on the page. The variable is not the problem. I am just not sure how to insert it into the form code.

Here is my rather feeble attempt so far...

In the header..

var goforward = 'http://widgit.com/info1.htm';

In the body...

<TD><form name="calc2" method="POST" action="http://fp1.formmail.com/cgi-bin/fm192">
<input type="hidden" name="_pid" value="51921">
<input type="hidden" name="_fid" value="AIE25230">
<input type="hidden" name="recipient" value="1">
<input type="hidden" name="Title">
<input type="hidden" name="redirect" value=goforward>

I also tried putting speech marks etc around the goforward eg value='goforward' or value="goforward".

Anyone help? Thanks, James

Mr J
Nov 10th, 2006, 02:05 PM
Once the variable has been assigned you would need to go something like


Nov 10th, 2006, 06:30 PM
OK tried that. But still seems to be a bug. Now I have in the head...

var goforward = 'http://widgit.com/info1.htm';

In the body I have an onclick which reads...

<TD vAlign=top width=45><div class="pic"><A href="#topanchor"
goforward = 'http://www.widgit.com/index4.htm';
<IMG name=imagew15 src="http://widgits.co.uk/widgit.jpg" Title="widgit" border=0></A></div></TD>

Lower down the form reads...

<TD><form name="calc2" method="POST" action="http://fp1.fwidgit.com/cgi-bin/fm192">
<input type="hidden" name="_pid" value="4354">
<input type="hidden" name="_fid" value="AIE25440">
<input type="hidden" name="recipient" value="1">
<input type="hidden" name="Title">
<input type="hidden" name="Redirect" value=goforward>
<input class=text3 type="text" name="email" size="45">
<input type="submit" value="Submit Order">

After the click I am hoping that it redirects to http://www.widgit.com/index4.htm. At the moment i just receive a form with the text "Redirect: http://www.widgit.com/index4.htm. There is no actual redirection.