Jump to content


Photo

Need more than one action on form.


  • Please log in to reply
4 replies to this topic

#1 jwk811

jwk811
  • Members
  • PipPipPip
  • Advanced Member
  • 714 posts

Posted 24 August 2006 - 03:57 AM

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.

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 24 August 2006 - 04:51 AM

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.
Legend has it that reading the manual never killed anyone.
My site

#3 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 24 August 2006 - 08:57 AM

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.

#4 jwk811

jwk811
  • Members
  • PipPipPip
  • Advanced Member
  • 714 posts

Posted 24 August 2006 - 04:11 PM

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!

#5 drkstr

drkstr
  • Members
  • PipPipPip
  • Advanced Member
  • 66 posts
  • LocationSeattle, WA - USA

Posted 25 August 2006 - 03:36 AM

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  ???
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
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 ;)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users