One form,one button,two action

how i can trigger two action in one form when user click a single button

Do you mean javascript actions or form actions?

Javascript: Just put two javascript functions for the onclick property of the button.

Form: Place both action handlers in the same page which is where your action=“” points to in the form. Then make two submit buttons and assign different values to it. Validate the values in the action handler page.

Form: Place both action handlers in the same page which is where your action=“” points to in the form. Then make two submit buttons and assign different values to it. Validate the values in the action handler page.

but i need just one button only to trigger two action

What, you want the user to go to foo.com and bar.com at the same time when they click the button? :confused:

no, I mean trigger two action(php process),not url

IMHO it shoulds as simple as catching the $_POST, call action 1, and let action 1 call action 2, or am I missing something?

give me more details about your suggestion
I can’t understand,sorry pal

function action1()
{
// handle some stuff
action2();
}

function action2()
{
// handle some more stuff
}

if ($_POST[‘someButton’])
{
action1();
}

A PHP process is ‘triggered’ by going to a specific URL. So triggering two PHP processes means going to two URLs at the same time. Can’t be done, obviously.

As ScallioXTX said, you can combine these two things server-side. Call one PHP script and let it do its thing and then forward to the other one. Of course, only the last one can produce any visible output.

A more complex (and less accessible) method would be to call one via XMLHttpRequest and then use the second one as the form’s action URL.