[英]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.