Drupal webform,我如何制作一个使用 GET 参数触发 php 脚本的表单?

发布于 2024-12-16 19:49:17 字数 236 浏览 3 评论 0原文

我想在 Drupal 7 中创建一个表单。 用户将选择适当的列表框、单选按钮选项。 当用户单击“提交”按钮时,表单将使用 GET 参数将相关值发布到另一个 php 文件。

  • 默认提交按钮显示电子邮件发送/注册的确认页面。我无法通过更改表单的提交行为来使表单将参数发布到 php 文件。

两天来我尝试了 Webform 模块来做到这一点。 如果您能推荐我一些制作方法,我会很高兴?示例、试用、模块、代码等

I want to create a form in Drupal 7.
User will select appropriate listbox, radio button options.
When user clicks Submit button, form will post related values to another php file with GET arguments.

  • Default submit button shows a confirmation page for email sending/registration. I couldn't make the form to post arguments to a php file by changing submit behaviour of the form.

For two days I tried Webform module to do this.
I would be happy if you can recommend me some way to make this? Examples, tryouts, modules, codes, etc

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

各空 2024-12-23 19:49:17

有“更好”的方法,但这将在自定义模块中发挥作用:

function mymodule_form_alter(&$form, &$form_state, $form_id) {
  $nid = 1; // Or whatever the node ID of your webform is
  if ($form_id == 'webform_client_form_' . $nid) {
    $form['#action'] = 'my-script.php';
    $form['#method'] = 'get';
  }
}

当然请记住,原始的 Web 表单提交功能将不会运行,因此您的 Web 表单数据不会保存到数据库中。

There are 'better' ways but this will do the trick in a custom module:

function mymodule_form_alter(&$form, &$form_state, $form_id) {
  $nid = 1; // Or whatever the node ID of your webform is
  if ($form_id == 'webform_client_form_' . $nid) {
    $form['#action'] = 'my-script.php';
    $form['#method'] = 'get';
  }
}

Bear in mind of course that the original webform submission functions will not run so your webform data won't be saved to the database.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文