Question: I have one form: 

```
<form method="POST" action="index.php">

```

And 2 button 

```
<button name='button1'></button>
<button name='button2'></button>

```

What I want is on click `button1` then form post to index.php, but on click of `button2` then form post to index2.php.

OR 

Click two button form post to index.php, after index.php post array to index2.php. I'm not use GET function!

Answer: 
remove action in your form This will only redirect to index.php.

```
<form method="POST" >
<button name='button1' onclick=my();></button>
<button name='button2'onclick=my1();></button>
</form>
<script>
 function my() {
  window.location.href = 'index.php';
  }   
  function my1() {
  window.location.href = 'index2.php';
  }
  </script>

```
I am not sure why you submit form to two d/t urls but try doing something like this: 

Add these two submit buttons with in your form. 

```
<input type = "submit"  name='submit1' value = "submit1" />
<input type = "submit"  name='submit2' value = "submit2" />

```

So when the user clicks submit button one, the variable `name=submit1` will be submitted to the server.

When the user clicks submit button two, the variable `name=submit2` will be submitted to the server.

Then on your server side you can do something like this:

```
if(is_set($_POST['submit1']) && $_POST['submit1'] == 'submit1'){
   //code
}else if(is_set($_POST['submit2']) && $_POST['submit2'] == 'submit2'){
   //code
}

```