Jump to content

Archived

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

jwk811

Need more than one action on form.

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.

Share this post


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

Share this post


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

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
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 ;)

Share this post


Link to post
Share on other sites

×

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.