gpt4 book ai didi

php - 我可以在 Meta Http Equiv Refresh 中传递变量吗?

转载 作者:行者123 更新时间:2023-12-03 22:59:13 25 4
gpt4 key购买 nike

我刚刚完成这个脚本,它运行良好,但我正在努力将 $invite 变量传递到 register.php 页面。有人可以告诉我如何实现这一目标吗?我将其定义为 $invite = $_POST['inviteinput'];

如何让用户输入从 index.php 传输到 register.php?感谢您的帮助!

HTML 格式:

    <form action="index.php" method="post">
What is your Invite Code?<BR />
<input class="textbox" name="inviteinput" type="text" />
<BR />
<input type="hidden" name="formsubmitted" value="TRUE" />
<input name="Submit" type="submit" value="Verify" />
</form>

PHP:

<?PHP
include ('scripts/dbconnect.php');

if (isset($_POST['formsubmitted'])) {

if (empty($_POST['inviteinput'])) {
echo '<div class="errormsgempty"><u>ERROR</u>:<br>You must enter a valid invite code to proceed!</div>';
} else {


$invite = $_POST['inviteinput'];//else assign it a variable
$invite = stripslashes($invite);
$invite = mysql_real_escape_string($invite);

$sql = "SELECT yourMemberId FROM Register WHERE yourMemberId='$invite'";
$result = mysql_query($sql);

if(mysql_num_rows($result) > 0) {

echo '<META HTTP-EQUIV="Refresh" Content="0; URL=register.php">';
} else {
echo '<div class="errormsgbox"><u>ERROR</u>:<br>The Invite Code you entered ' . $invite . ' is NOT a valid invite code!</div>';
//($notvalidcode = "The Invite Code you entered <strong>" . $invite . "</strong> is NOT a valid invite code!");
}
}
}
?>

最佳答案

当然。只需将其添加到 URL:

<meta http-equiv="Refresh" Content="0; url=register.php?var=value&othervar=hello" />

请注意,您最好使用:

header("Location: register.php?var=value&othervar=hello");
exit;

关于php - 我可以在 Meta Http Equiv Refresh 中传递变量吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11217127/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com