jwk811 Posted August 24, 2006 Share Posted August 24, 2006 I would like a form that had more than one action. Mainly one to send me an email of the data and another one to send the data to another page to be caught from there. I know how to send to a mail server and redirect to another page. But when I redirect to another page the data can not be caught. I didn't think it was possible to have more than one action but someone told me that you needed to have a custom form. So, if anyone knows anything about this I would really apreciate some answers. Quote Link to comment https://forums.phpfreaks.com/topic/18495-need-more-than-one-action-on-form/ Share on other sites More sharing options...
AndyB Posted August 24, 2006 Share Posted August 24, 2006 How is this different from the thread you already have open asking the same questions?Multiple threads by the same person about the same thing are against forum rules. Quote Link to comment https://forums.phpfreaks.com/topic/18495-need-more-than-one-action-on-form/#findComment-79684 Share on other sites More sharing options...
wildteen88 Posted August 24, 2006 Share Posted August 24, 2006 If you want to use the data on another page then youm might want to store the data in a cookie or a session. That way you can use that data on the other page you are going to redirect the user to. Quote Link to comment https://forums.phpfreaks.com/topic/18495-need-more-than-one-action-on-form/#findComment-79763 Share on other sites More sharing options...
jwk811 Posted August 24, 2006 Author Share Posted August 24, 2006 Oh, that seems like what I'm trying to do, but I don't have a clue how to make cookies or sessions. I will look further on that but if you could give me a few pointers that would be great! Quote Link to comment https://forums.phpfreaks.com/topic/18495-need-more-than-one-action-on-form/#findComment-79897 Share on other sites More sharing options...
drkstr Posted August 25, 2006 Share Posted August 25, 2006 You could use javascript to do this. **edit** note: you need to wrap less then/greater then symbols around the SCRIPT tags. It wouldn't let me post this for some reason ???[code]SCRIPT language="javascript"function callActionOne( ) { var strData = <?php print urlencode( serialize($your_object) ); ?> //need to convert to a string if data is an object var url = "/action_one.php?data="+strData; window.open(url, "_self");}function callActionTwo( ) { var strData = <?php print serialize($your_object); ?> //need to convert to a string if data is an object var url = "/action_two.php?data="+strData; window.open(url, "_self");}/SCRIPT[/code]use unserialize( urldecode($_GET['data']) ) on the action page to convert back to an object.and add something like this on the page calling the actions<input type="button" value="Action One" onclick="javascript:callActionOne()" /><input type="button" value="Action Two" onclick="javascript:callActionTwo()" />regards,...drkstr**edit again**wildteen88 method is probably better programming practive though ;) Quote Link to comment https://forums.phpfreaks.com/topic/18495-need-more-than-one-action-on-form/#findComment-80172 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.