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'm using

```
<script type="text/javascript">
    function doPreview()
    {
        form=document.getElementById('idOfForm');
        form.target='_blank';
        form.action='<?php echo Base_dir . 'email/create'; ?>';
        form.submit();
        form.action='#';
        form.target='';
    }
</script>

```

And use onclick in button :)

Thanks all!