Php 将值从第1页传递到第2页并显示值

Php 将值从第1页传递到第2页并显示值,php,Php,此my id num列包含一个值 <td>ID NUMBER:</td> <td><input type="hidden" name="txtEmpID" value="<?php echo $this->getArr['id']?>"> <input type="text" <?php echo (isset($this->postArr['EditMode']) && $this->p

此my id num列包含一个值

 <td>ID NUMBER:</td>
<td><input type="hidden" name="txtEmpID" value="<?php echo $this->getArr['id']?>">
<input type="text" <?php echo (isset($this->postArr['EditMode']) && $this->postArr['EditMode']=='1') ? '' : 'disabled'?> name="txtEmployeeId2" value="<?php echo (isset($this->postArr['txtEmployeeId']))?$this->postArr['txtEmployeeId']:$edit[0][5]?>" maxlength="50">

请帮助我

将元素包装在表单中,并将表单发布到页面中。然后,如果您的方法是post,则可以通过
$\u post
访问post数据,如果您的方法是GET,则可以通过
$\u GET
访问post数据

<form method="post" action="reset.php">
<td>ID NUMBER:</td>
<td><input type="hidden" name="txtEmpID" value="<?php echo $this->getArr['id']?>">
<input type="text" <?php echo (isset($this->postArr['EditMode']) && $this->postArr['EditMode']=='1') ? '' : 'disabled'?> name="txtEmployeeId2" value="<?php echo (isset($this->postArr['txtEmployeeId']))?$this->postArr['txtEmployeeId']:$edit[0][5]?>" maxlength="50">
</td>
</form>

将元素包装在表单中,并将表单发布到页面中。然后,如果方法为post,则可以通过
$\u post
访问post数据;如果方法为GET,则可以通过
$\u GET
访问post数据

<form method="post" action="reset.php">
<td>ID NUMBER:</td>
<td><input type="hidden" name="txtEmpID" value="<?php echo $this->getArr['id']?>">
<input type="text" <?php echo (isset($this->postArr['EditMode']) && $this->postArr['EditMode']=='1') ? '' : 'disabled'?> name="txtEmployeeId2" value="<?php echo (isset($this->postArr['txtEmployeeId']))?$this->postArr['txtEmployeeId']:$edit[0][5]?>" maxlength="50">
</td>
</form>

我可以想出两种方法来做到这一点

第一种是使用表单。

name=“txtEmployeeId2”value=”“maxlength=“50”>
第二 就是使用Javascript/jQuery获取值,并将其作为等效的get请求通过URL传递

但是,您需要某种触发器来调用javascript函数,例如按钮

<button onclick="sendValue()">Submit</button>

<script type="text/javascript">
    function sendValue()
    {
        parent.location = 'reset.php?txtEmployeeId2='+document.getElementById("txtEmployeeId2").value;
    }
提交
函数sendValue()
{
parent.location='reset.php?txtEmployeeId2='+document.getElementById(“txtEmployeeId2”).value;
}
请注意,这将要求您将ID属性添加到文本框中

对于这两种解决方案,您只需更改reset.php文件中的行:

这是假设输入的name属性和ID属性都相同。将“txtEmployeeId2”替换为您希望为文本框输入提供的任何名称或ID



有两种方法可以做到这一点

第一种是使用表单。

name=“txtEmployeeId2”value=”“maxlength=“50”>
第二 就是使用Javascript/jQuery获取值,并将其作为等效的get请求通过URL传递

但是,您需要某种触发器来调用javascript函数,例如按钮

<button onclick="sendValue()">Submit</button>

<script type="text/javascript">
    function sendValue()
    {
        parent.location = 'reset.php?txtEmployeeId2='+document.getElementById("txtEmployeeId2").value;
    }
提交
函数sendValue()
{
parent.location='reset.php?txtEmployeeId2='+document.getElementById(“txtEmployeeId2”).value;
}
请注意,这将要求您将ID属性添加到文本框中

对于这两种解决方案,您只需更改reset.php文件中的行:

这是假设输入的name属性和ID属性都相同。将“txtEmployeeId2”替换为您希望为文本框输入提供的任何名称或ID



您也可以使用会话。(
$\u SESSION
超全局数组)

您也可以使用SESSION。(
$\u SESSION
superglobal array)

如果您使用表单,则可以传递此值。您可以使用表单将值发布到reset.php,并在reset.php中以$\u post['txtEmpID']的形式访问,您应该使用,并且您可以选择使用GET方法,POST方法或会话。您是否已经能够在reset.php中获取
txtEmployeeId2
?然后,
txtEmpID
应该以完全相同的方式完成。如果使用表单,则可以传递此值。您可以使用表单将值发布到reset.php,并在reset.php中以$\u post['txtEmpID']的形式访问,您应该使用,并且您可以选择使用GET方法,POST方法或会话。您是否已经能够在reset.php中获取
txtEmployeeId2
?那么
txtEmpID
应该以完全相同的方式完成。David,我使用第二种方法,看看这个
函数open\u win(){window.open(“http://localhost/ESSLASCREST_DEV_vQA_01/templates/hrfunct/resetPass.php“,”空白“,“toolbar=yes,location=center,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=no,copyhistory=yes,width=400,height=400”);}
如何在这个函数中获取elementById?David,我使用第二种方法,看看这个
函数open_win(){window.open(”http://localhost/ESSLASCREST_DEV_vQA_01/templates/hrfunct/resetPass.php“,”_blank“,”toolbar=yes,location=center,directories=no,status=no,menubar=yes,scrollbars=yes,resizeable=no,copyhistory=yes,width=400,height=400”);}
如何在此函数中获取ElementById?
<button onclick="sendValue()">Submit</button>

<script type="text/javascript">
    function sendValue()
    {
        parent.location = 'reset.php?txtEmployeeId2='+document.getElementById("txtEmployeeId2").value;
    }
<input name="staffid" type="text" class="textfield_login" value="how to display the value from 1st page into here?"/>
<input name="staffid" type="text" class="textfield_login" value="<?php echo $_GET["txtEmployeeId2"];?>"/>