这是我的代码。在我单击按钮转到“playlist.php”文件后,变量并没有像“post”命令中那样被转移。帮助?
编辑:这是文档中发送变量的代码。
if(empty($name) || empty($email)){
echo '<h1>Please fill out all fields.</h1>';
}else{
$dup = mysql_query("SELECT name FROM sets WHERE name='".$_POST['name']."'");
if(mysql_num_rows($dup) >0){
echo '<h1>Username Already Used.</h1>';
}
else{
$sql = mysql_query("INSERT INTO sets VALUES ('','$name','$email')");
if($sql){
$to = $email;
$email_subject = "You've created a playlist!";
$email_body = "Thanks for signing up! ".
" Here are the details you used to sign up with:\n Name: $name \n Email: $email";
$headers = "From: email@email.com";
$headers .= "Reply-To: email@email.com";
mail($to,$email_subject,$email_body,$headers);
echo '<form action="playlist.php" method="post">
<input type="hidden" name="name" value="<?php echo $name; ?>">
<p class="text-center"><button type="submit" class="btn btn-primary btn-large">Visit my Playlist!</button></p>
</form>';
}
else{
echo '<h1>Error in Registration.</h1>';
}
}
}