Click to See Complete Forum and Search --> : On submit=>2 actions


svenicsale
06-10-2003, 10:19 AM
I hitnk that this post belongs ere more then in HTML, so here it is:
I was wondering if htere is a way to make one submit button do two actions, like for ex.
"<form method=post action='subscribe.cgi'>"

can be made like: "<form method=post action='subscribe.cgi; subsribe.php'>"

Dave told me that I should use timed delay (about 2-3 seconds worth) for a function that would trigger the second submit for the second action... But I don't know how to implment it to a code... So I would need a code for it, or some other method to do it...

Khalid Ali
06-10-2003, 11:09 AM
I seriously doubt you can do that here is why.

When a submit event is triggered it initialzes the action attribute of the form element.
Once action is started then the hwol parent html page is out of scope,and since its out of the scope therefore anything else that is (assuming ) left on the page will not happen.

To me its not a good design(but thats just me)What you should be doing is on the CGI page redirect to the subscribe.php..that will be do able and make more sense.

svenicsale
06-10-2003, 11:54 AM
Well both scripts, subscribe.cgi and subscribe.php, are used to subscribe emails so when someone enters his email in the BOX and clicks Submit, it subscribes him through both scripts... One script subscribes user on one list, and one to other list...
Maybe if I putt into subscribe.php code which will redirect to *.cgi that will use the same values I used to subsribe for the PHP version... One more thing is that I don't know how the subscribe.cgi looks like, but it uses all the values from the *.JS file I will write down, but the subsriber.php uses(sends) only two valuables($proba and $list), but see yourself below.

-----subscribe.js------
<!-- Begin
function EmailSubscribe(_id, _title) {
windowprops = "left=0,top=0,scrollbars=1,resizable=1,width=560,height=95";

text = "<html><title>Free Pix In Your Mail</title><body bgcolor='#000000'>"
text += "<form method=post action='mail2.php'>"
text += "<input type=hidden name='sponsor' value='mrx'>"
text += "<input type=hidden name='HTML' value='Y'>"
text += "<input type=hidden name='list' value='" + _title + "'>"
text += "<input type=hidden name='ecspon' value='nobanner'>"
text += "<table bgcolor='#ff00ff' border=0 cellpadding=2 cellspacing=0><tr><td>"
text += "<table bgcolor='#aa00ff' border=0 cellpadding=2 cellspacing=0>"
text += "<tr><td align=center><font face=arial size=2 color='#ffffff'><b>Subscribe to " + _title + " for FREE and Get Daily Pix In Your E-mail!</b></font><br>"
text += "<font color='#ffffff' face=arial size=2><b>E-mail Address:</b></font>"
text += "<input type=text name='probni' value='Enter Email Here' size=30 maxlength=49>"
text += "<input type=submit value='Subscribe'><br>"
text += "<font face=arial color='#000000' size=1><b>Your e-mail address will be kept strictly confidential and not given or sold to anyone.<br>"
text += "After subscribing wait a few minutes then read your e-mail for full details.</b></td></tr></table></td></tr></table></form><body></html>"

preview = window.open("", "subscribe", windowprops);
preview.document.open();
preview.document.write(text);
preview.document.close();
}
// End -->

------subscribe.php------
<?php

$headers .= "From: $probni \n";
$headers .= "Content-Type: text/plain; charset=iso-8859-1\n";
$recipient = "youremail@hotmail.com";
$subject = "Pictures in email";
$msg = wordwrap( $list, 1024 );
mail($recipient, $subject, stripslashes($msg), $headers);

header("location: thanks.php");
?>