How to add a function to a form
<p>I have a form like this :</p>

<pre><code>$form  = '&lt;form action="https://www.zarinpal.com/users/pay_invoice/'.$res.'"
method="post" target="_parent" &gt;&lt;input type="submit"  value="Buy"/&gt;&lt;/form&gt;';
$form .= '&lt;/form&gt;';
echo $form;
</code></pre>

<p>I want to add a function to this form, so when "Buy" is clicked, then in MySQL a database is created for this user with the information of the selected item and his account id with a pending transaction status, and then the form redirects him to the webpage included.</p>

<p>I can manage the MySQL part, but the form only redirects the user to the given webpage, and i can not add users information to the database.</p>

<p>Is there a way I can add a database row for this user, then redirect him to the payment webpage ? ( except creating another page )</p>
