Jump to content

[SOLVED] POST Form data via CGI Redirect possible..??


drillbitt

Recommended Posts

Hey Guys,

 

I have just upgraded a script, which as well as many other things is now php based as opposed to it being previously CGI

 

The issue I have is, the script features a subscription option, which of couse submits not only to a different locatation now, but also has changed to php.

 

i have migrated all my script users over to the new version, and whilst i have told them about updating the form codes on their pages, I wondered how I set up a permanent form-redirect cgi page, for those few optin forms that slip through the update?

 

Bottom line is I want any form thats submitted to http://mysite.com/cgi-bin/optin.cgi to be re-directed (Or re-posted, not sure which syntax is correct!) to http://mysite.com/newscript/optin.php

(All other details of the form are identical)

 

Is this at all possible??

 

Cheers!

I tried this :

Redirect /home/username/public_html/cgi-bin/optin.cgi http://sitename.com/v2/ar/optin.php

as the .htaccess file. based on the guidance given here: http://www.javascriptkit.com/howto/htaccess7.shtml

 

I uploaded it to the root folder, but It didn't do anything at all, it allowed the cgi-bin/optin.cgi file to process the form.

 

Did i miss something crucial??

 

EDIT: tried again and received a 500 error...any ideas??

COOL!! I think i'm almost there! The error has gone, and the .htaccess file is certainly redirecting the user to the new signup page as I wanted... I am however receiving an error message regarding the signup process (But at least this time its coming from the correct script!!)

 

Heres the old code, along with the new, apart from the URL, I can't see any difference, but when i test it I receive an error message saying I'm using the wrong form to subscribe:

 

Old Code:

<script language="JavaScript">
function checkSub(){
if (document.signup.email.value.indexOf('@', 0) == -1) {
alert("Please fill in your valid Email address.\nYour email should be in the following format: [email protected]")
document.signup.email.focus()
return false}
if (document.signup.fname.value == "") {
alert("Please fill in your First name.")
document.signup.fname.focus()
return false}                          
}</script><form action="http://mysite.com/cgi-bin/ent/optin.cgi" method="post" name="signup" onsubmit="return checkSub()"><input type=hidden name="action" value="addlead"><input type=hidden name="member" value="1"><input type=hidden name="auto" value="1"><input type=hidden name="thankyou" value=""><table border=0 cellspacing=0 cellpadding=2><tr><td><font size="2" face="arial, verdana">First Name:</font></td><td><input type=text size=20 name="fname"></td></tr><tr><td><font size="2" face="arial, verdana">Email Address:</font></td><td><input type=text size=20 name="email"></td></tr><tr><td></td><td align=center><input type="submit" value="Subscribe"></td></tr></table></form>

 

And the code generated by the new script is:

<script language="JavaScript">
function checkSub(){
if (document.signup.email.value.indexOf('@', 0) == -1) {
alert("Please fill in your valid Email address.\nYour email should be in the following format: [email protected]")
document.signup.email.focus()
return false}
if (document.signup.fname.value == "") {
alert("Please fill in your First name.")
document.signup.fname.focus()
return false}                          
}</script><form action="http://mysite.com/v2/ar/optin.php" method="post" name="signup" onsubmit="return checkSub()"><input type=hidden name="action" value="addlead"><input type=hidden name="member" value="1"><input type=hidden name="auto" value="1"><input type=hidden name="thankyou" value=""><table border=0 cellspacing=0 cellpadding=2><tr><td><font size="2" face="arial, verdana">First Name:</font></td><td><input type=text size=20 name="fname"></td></tr><tr><td><font size="2" face="arial, verdana">Email Address:</font></td><td><input type=text size=20 name="email"></td></tr><tr><td></td><td align=center><input type="submit" value="Subscribe"></td></tr></table></form>

 

I can't see any difference. Any idea what might be causing it? It feels like I'm SO close now!

 

It directs to the new script, but the error message appears:

Incorrect form  
Sorry but an error has occured. Please use the correct form to subscribe.

 

It seems strange, because all the details of the form submission are the same, including all the identifiers...

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.