Jump to content

Need more than one action on form.


jwk811

Recommended Posts

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.
Link to comment
Share on other sites

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 ;)
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.