在abc.php中,我有一个表单,其动作是xyz.php。我想在{xyz.php
中使用$email=$POST['txtEmail']
为此,我输入了:<form id="form1" name="form1" method="post" action="xyz.php?<?php $email=$_POST['txtEmail']; ?>">
这是正确的方法吗?
修改
abc.php
<form id="form1" name="form1" method="post" action="xyz.php">
<input name="txtEmail" type="text" size="30" />
<input type="submit" name="Submit2" value="Submit" />
</form>
xyz.php
<form id="form1" name="form1" method="post" action="def.php">
<input type="text" name="txtAns" />
<input type="hidden" name="txtEmail" id="txtEmail" value="<?php echo $_POST['txtEmail']; ?>" />
<input type="submit" name="submitEmail" value="Submit" />
</form>
def.php
$email=$_POST['txtEmail'];
答案 0 :(得分:2)
<强>被修改强>
在abc.php中:
<form id="form1" name="form1" method="post" action="xyz.php">
<input type="text" name="email" id="email" />
</form>
在xyz.php中
<form id="form2" name="form2" method="post" action="def.php">
<input type="hidden" name="email" id="email" value="<?php echo $_POST['email']; ?>" />
</form>
在def.php中
$email = $_POST['email'];
这就是你要追求的吗?