Hi all,

I've been trying to solve this problem for like 3 hours, but couldn't solve it, so any help would be appreciated.


I want to perform 2 actions on 1 form and on 1 submit.
address1 - i only have to send datas
address2 - i have to send datas AND go to that address.

Here's the form:

<form method="post" action="??">

.......

<input type="submit" ...>
</form>

I've tried something like this, but didn't work:

little trick:

function actions(f){
f.action='address1';
f.target='action1';
f.submit();
f.action='address2';
f.target='_self';
f.submit();
}

part of that trick:

<iframe name="action1" width="1" height="1" frameborder="0" scrolling="no"></iframe>

and the form:

<form method="post">
....
<input type="button" onclick="actions(this.form)">

logically, this trick should work, but it throws me to the 405 not allowed page.


bro`s, help me out please.

Recommended Answers

All 4 Replies

come on guys...

i think,

In html form, 2 action is not possible

Hi all,

I've been trying to solve this problem for like 3 hours, but couldn't solve it, so any help would be appreciated.


I want to perform 2 actions on 1 form and on 1 submit.
address1 - i only have to send datas
address2 - i have to send datas AND go to that address.

Here's the form:

<form method="post" action="??">

.......

<input type="submit" ...>
</form>

I've tried something like this, but didn't work:

little trick:

function actions(f){
f.action='address1';
f.target='action1';
f.submit();
f.action='address2';
f.target='_self';
f.submit();
}

part of that trick:

<iframe name="action1" width="1" height="1" frameborder="0" scrolling="no"></iframe>

and the form:

<form method="post">
....
<input type="button" onclick="actions(this.form)">

logically, this trick should work, but it throws me to the 405 not allowed page.


bro`s, help me out please.

php is fine with me.

You need to learn ajax.
Instead of the submit button, submitting the form via the action the submit button calls a function. That function can have an ajax call in it to do the job of submitting the form, but that same function could do a host of other things, including another ajax call.

http://www.w3schools.com/ajax/default.asp

This taught me ajax, have a go and post back if you're still stuck

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.