One form, one button, two actions?

佐手、 提交于 2019-12-12 01:46:42

问题


I have a page orderbelow.php which has a form on it with one button "Order Now".

The form is submitted to send-order.php which sends an email to the website owner. The script on send-order.php also directs the user to a new page completeyourorder.php.

There is a form on completeyourorder.php with a button that has the action of sending the user to paypal to complete the payment.

Is it possible to have one button on the first form orderbelow.php that sends the email to the owner, and sends the user to paypal?

This will remove one step in the current process.

Thanks


回答1:


You can either send a email to the owner without refreshing the page: this should be done with AJAX (fancy name for simple Javascript requests sending ^^).

You can also add a location header in your first PHP script to automatically redirect to the second PHP script: this should be done with the function header in PHP.



来源:https://stackoverflow.com/questions/38719314/one-form-one-button-two-actions

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!