我如何给出一个';提交';在php中单击多个操作?

我如何给出一个';提交';在php中单击多个操作?,php,forms,function,button,form-submit,Php,Forms,Function,Button,Form Submit,我有一个表单,在提交时我希望它做两件事: 1) 在数据库中存储值 2) 将$\u POST值写入pdf 我有一个用于数据库写入的脚本,它可以自己工作。我有另一个脚本用于编写PDF,它本身也可以很好地工作 但是,当我尝试在另一个函数的末尾调用一个函数时,submit操作只执行其中一个操作。我怎样才能解决这个问题。我希望我的按钮同时执行store.php和makepdf.php 目前,我只能在表单的action标签中指定一个表单 编辑:我在这里添加脚本 这是我的store.db文件(因长度限制而连接

我有一个表单,在提交时我希望它做两件事: 1) 在数据库中存储值 2) 将$\u POST值写入pdf

我有一个用于数据库写入的脚本,它可以自己工作。我有另一个脚本用于编写PDF,它本身也可以很好地工作

但是,当我尝试在另一个函数的末尾调用一个函数时,submit操作只执行其中一个操作。我怎样才能解决这个问题。我希望我的按钮同时执行store.php和makepdf.php

目前,我只能在表单的action标签中指定一个表单

编辑:我在这里添加脚本

这是我的store.db文件(因长度限制而连接):


简单地在PHP中包含一个脚本到另一个脚本中

store.php
脚本中尝试以下操作:

include("makepdf.php");
仅供参考,您也可以从一个脚本调用另一个脚本,但需要将post参数与文件名一起传递,如下所示:

file_get_contents("makepdf.php?param1=".$_POST['param1']."&param2=".$_POST['param2']);

您指的是

怎么样



在看不到您的代码的情况下,我们只能推测……我们做得不太好。我应该包括所有三个脚本吗?表单一次只能提交到一个url。为什么您希望“提交按钮”执行两种不同的操作?这不正是表单提交的工作吗?让那个脚本成为
很简单,我已经用我的脚本更新了。我不知道是谁否决了你,我不认为是我。我已经用我的脚本更新了。别担心。你试过包含吗?
<form class="form-horizontal" method="post" action="">
<fieldset>

<!-- Text input-->
<div class="form-group">
  <label class="col-md-4 control-label" for="firstname">First Name</label>  
  <div class="col-md-4">
  <input id="firstname" name="firstname" type="text" placeholder="" class="form-control input-md">

  </div>
</div>

<!-- Text input-->
<div class="form-group">
  <label class="col-md-4 control-label" for="lastname">Last</label>  
  <div class="col-md-4">
  <input id="lastname" name="lastname" type="text" placeholder="" class="form-control input-md">

  </div>
</div>

<!-- Text input-->
<div class="form-group">
  <label class="col-md-4 control-label" for="email">Email</label>  
  <div class="col-md-4">
  <input id="email" name="email" type="text" placeholder="" class="form-control input-md">

  </div>
</div>

<!-- Text input-->
<div class="form-group">
  <label class="col-md-4 control-label" for="idn">ID#</label>  
  <div class="col-md-4">
  <input id="idn" name="idn" type="text" placeholder="" class="form-control input-md">

  </div>
</div>

</fieldset>
</form>
include("makepdf.php");
file_get_contents("makepdf.php?param1=".$_POST['param1']."&param2=".$_POST['param2']);
<form action="/path/my_form_handler.php">
    <input type="submit" name="dowhat" value="Do action A" />
    <input type="submit" name="dowhat" value="Do action B" />
</form>

<?php
if ($_POST['dowhat'] == "Do action A") {
    // something
    // even more than one thing
} else {
    // something else
    // etc
}
?>