如何在一个文件中采用各种形式的输入值. [英] how to take various form input values in one single file.

查看:49
本文介绍了如何在一个文件中采用各种形式的输入值.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,我在这个论坛上是新来的.我在想什么,想问你们.我正在一个文件太多的项目中工作.全部带有php扩展名.我网站的每个页面都有各种HTML表单.每次我创建一个新的php文件并将其链接到html表单标签的action属性时,就采用表单输入标签值.现在,我想知道如果我只能制作一个文件来识别项目中的所有表单,并且只要有任何表单提交到服务器,那么该文件将仅采用该特定表单的值.如果得到帮助,我将感到非常高兴.

Hello There, I am very new here in this forum. I was wondering about something and thought asking you guys. I am working with a project where I have too much files. all with php extensions. I have various HTML forms in every pages of my site. and every time I am creating a new php file and linking it up to action attribute of the html form tag, to take the form input tag values. Now I was wondering that If I could just make one file which recognize all the forms in my project and whenever any form is submitted to the server so the file will only take the values of that specific form. I will be really glad If I get a help.

推荐答案

听起来您想要一个php处理来自许多不同形式的输入.这很容易做到,但是随后您需要它知道提供数据的表单.有两种简单的方法可以做到这一点:
1.向每个表单添加一个隐藏的输入字段,每个表单具有相同的名称但值不同,因此您始终可以参考该输入字段以查看其是哪个表单.
It sounds like you want one php to handle the input from many different forms. That is easy to do, but then you need it to know which form provided the data. There are two simple ways to do this:
1. Add a hidden input field to each form with the same name but different values on each form, so you can always refer to that input field to see which form it was.
<form action="mycommonaction.php" method="get">
...
<input type="hidden" name="formid" value="form1"> 
...
</input></form>



原始形式 =
originalform =


_GET [' formid']; 如果(
_GET['formid']; if (


这篇关于如何在一个文件中采用各种形式的输入值.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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