简体   繁体   English

如何通过URL传递作为参数传递的PHP值并将其显示在HTML页面中以传递给另一个PHP文件

[英]How to pass php value which is passed as a parameter through url and displaying it in html page to be passed to another php file

I have html file where am using php code to display a value which is passed in url for example: 我有使用php代码显示html中传递的值的html文件,例如:

My variable value which is passed through url is "WORKSHOP" and variable name is "eventName" 我通过url传递的变量值为“ WORKSHOP”,变量名称为“ eventName”

Which is called in php page using php like as follows: 使用php在php页面中调用它,如下所示:

 <form action="reg_event_validate.php" method="post" id="htmlform" name="htmlform">
    <table  height="80% style="margin-top: 25px; margin-bottom: 60px; background-color:#D9E2F1; border-radius: 5px;" width="650px" align="center">
    <tbody>
    <tr>
    <th colspan="2">
    <?php
    // The value of the variable name is found
    echo "<h3>Event Registration : " . $_GET["name"] . "</h3>";
    ?> 
    </th>

Now i would like to pass that name(eg: WORKSHOP) value to reg_event_validation.php. 现在,我想将该名称(例如:WORKSHOP)值传递给reg_event_validation.php。 How to go about. 怎么做。 Please suggest some solution. 请提出一些解决方案。

Try to pass the value using a hidden input field like : 尝试使用隐藏的输入字段传递值,例如:

<input type="hidden" name="hiddenval" value="<?php echo $_GET["name"]; ?>"

and try to access this in form action page like 并尝试在表单操作页面中访问它,例如

echo $_POST['hiddenval'];

Use input type hidden 使用隐藏的输入类型

<input type='hidden' name='eventName' value='<?php echo $_GET["name"]; ?>' />

OR , Append as Query String ,附加为Query String

action="reg_event_validate.php?eventName=<?php echo $_GET["name"]; ?>"

You can do it in two ways. 您可以通过两种方式来实现。 Add a hidden input. 添加隐藏的输入。

<input type="hidden" name="workshop" value="some_value" />

Or you can append to action in form 或者您可以将动作附加到表单中

<form method="get" action="reg_event_validation.php?workshop=somevalue" name="form">
....

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何传递和使用通过 php 中的 header() 传递的变量从 1 个文件到另一个文件 - how to pass and use the variables passed through header() in php from 1 file to another 如何访问通过URL传递的值? - how to access value which passed through url? PHP默认参数值:编译器如何知道哪个参数传递的参数值? - PHP Default parameter values: How does the compiler know which passed parameter-value is for which parameter? PHP检查通过XSLT中的URL传递的有效参数 - PHP check for valid parameter passed through the URL in XSLT php按钮值未通过ajax传递到另一个php页面 - php button value not getting passed to another php page via ajax 通过URL传递变量时,PHP页面加载为空白 - PHP page loads blank when a variable is passed through the URL 如何重写通过get方法传递值的url,并将其传递给另一个页面? - How to rewrite a url in which values have been passed by get method and pass them to another page? URL 参数值传递给 PHP WordPress body_class - URL parameter value passed to PHP WordPress body_class 如何通过javascript将值从一页传递到另一页,并使用php获取另一页中传递的值? - How to pass values from one page to other page by javascript and get the passed value in the other page using php? 无法下载php中的文件。 通过url传递的文件名 - Not able to download a file in php. Filename passed through url
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM