Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/273.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何通过url将作为参数传递的php值传递给另一个php文件,并在html页面中显示该值_Php_Html - Fatal编程技术网

如何通过url将作为参数传递的php值传递给另一个php文件,并在html页面中显示该值

如何通过url将作为参数传递的php值传递给另一个php文件,并在html页面中显示该值,php,html,Php,Html,我有一个html文件,其中我使用php代码显示在url中传递的值,例如: 通过url传递的变量值是WORKSHOP,变量名是eventName 在php页面中使用php调用,如下所示: <form action="reg_event_validate.php" method="post" id="htmlform" name="htmlform"> <table height="80% style="margin-top: 25px; margin-bottom:

我有一个html文件,其中我使用php代码显示在url中传递的值,例如:

通过url传递的变量值是WORKSHOP,变量名是eventName

在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>
现在我想把这个名称EG:WORKSHOP值传递给reg_event_validation.php。如何进行。请建议一些解决方案。

使用输入类型隐藏

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

尝试使用隐藏的输入字段传递值,如:

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

你可以用两种方法来做。添加隐藏的输入

<input type="hidden" name="workshop" value="some_value" />
或者您可以在表单中附加到操作

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

您是在提交上述表单后尝试检索该值,还是在使用上述表单显示以前提交的值?另外,上面的表单使用POST和您使用$\u GET检索值,这可能会导致问题,具体取决于我的第一个问题。
<input type="hidden" name="workshop" value="some_value" />
<form method="get" action="reg_event_validation.php?workshop=somevalue" name="form">
....