使用导出按钮功能到另一个php文件

This is the form.php file and i would like to put export button file to another php file. I am still rocky for php language.

form php

<form action="<?php echo url_for("attendance/viewAttendanceRecord"); ?>" id="reportForm" method="post" name="frmAttendanceReport">
        <fieldset>
            <ol>
                <?php
                if ($form->hasErrors()) {
                    echo $form['employeeName']->renderError();
                }
                ?>
                <?php echo $form->render(); ?>
                <?php echo $form->renderHiddenFields(); ?>                

                <li class="required">
                    <em>*</em> <?php echo __(CommonMessages::REQUIRED_FIELD); ?>
                </li>
            </ol>
            <p class="formbuttons">
        <input type="button" class="" id="btExport" onclick='myfunction()' value="<?php echo __('Export') ?>"/>

I want to use export function in this action.php file

action.php

if($post['export'] == '1')
{
  //statement
}

Php uses name attribute of the elements in order to build $_POST array. So add name attribute to button along with other input elements as follows.

<input type="submit" id="btExport" name="btExport" value="<?php echo __('Export') ?>"/>

in action.php do something like the following to handle posted values.

if($_POST["btExport"])
{
  //statement
}

or you can also check if $_POST is empty or not as follows

if (!empty($_POST))
{
  //statement
}