php - 在一种表单中提交两个不同的目的地

标签 php mysql submit

我有一个表单需要将数据提交到同一数据库中的两个不同表中。 过去我曾问过如何将表单提交到两个表中,但这是不可能的。

然后,我尝试使用两个具有不同目的地的提交按钮来提交此表单。 您能给一些点击后提交此表格的建议吗?

最佳答案

Javascript:

function button1click() {
  yourForm.action = "ajax1.php";
  yourForm.submit();
}

function button2click {
  yourForm.action = "ajax2.php";
  yourForm.submit();
}

HTML:

<form action='' method='post'>
  <input type='input' id='blah' name='blee' />
  <button type='button' onclick='button1click()'>Button 1</button>
  <button type='button' onclick='button2click()'>Button 2</button>
</form>

关于php - 在一种表单中提交两个不同的目的地,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3938983/

相关文章:

php - 如何使用查询生成器 laravel 将多条记录插入 mysql

php - 从一个 SQL 语句中获取一列中的所有行

python - MySQL 使用 Python 删除表中的行

php - 并行写入 MySQL 数据库表 - 会导致任何问题吗?

JQuery 提交在 Chrome 中不起作用

php - Behat 和 Symfony 数据装置

javascript - redis php 和 javascript 连接

MySQL 数据库为什么 Õ 在搜索时返回为 O

javascript - jQuery 绑定(bind)提交导致问题

html - 输入提交按钮中的 Font Awesome 图标和文本?