相同的表单数据,两个单独的提交按钮上的不同操作 [英] same form data, different actions on two separate submit buttons

查看:46
本文介绍了相同的表单数据,两个单独的提交按钮上的不同操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个基本上是购物车,需要有两个单独的结账选项。第一个是用户离开网站,但必须发布表单数据。

I have what is essentially a shopping cart that needs to have two separate checkout options. The first of which takes the user away from the site, but form data must be posted.

如何创建两个提交按钮,将相同的表单数据发送到他们的拥有单独的页面?

How can I create two submit buttons that will send the same form data to their own separate page?

推荐答案

如果我理解正确,你在同一页面上有两个提交按钮,它们都有相同的如果是这样,这应该可以解决问题。

If I understand correctly, you have 2 submit buttons on the same page and both of them have the same form if that is so, this should do the trick.

if(isset($_POST['name1'])) {
//do stuff
}

if(isset($_POST['name2'])) {
//do other stuff
}

这篇关于相同的表单数据,两个单独的提交按钮上的不同操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆