session
的值应该可以,但是我无法在window.location
中进行检索,有人可以帮忙吗?
echo "<script>window.location='index.php?' + 'gp_name=' + '<?php echo $gname';?>'</script>";
代码:
require_once 'connection.php';
session_start();
$gname = $_SESSION['gp_name'];
if(ISSET($_POST['submit'])){
if($_FILES['upload']['name'] != "") {
$file = $_FILES['upload'];
$file_name = $file['name'];
$file_temp = $file['tmp_name'];$name = explode('.', $file_name);
$path = "files/".$file_name;
$conn->query("INSERT INTO `file` VALUES('', '$gname', '$name[0]', '$path')") or die(mysqli_error());
move_uploaded_file($file_temp, $path);
header("location:index.php");
}else{
echo "<script>alert('Required Field!')</script>";
echo "<script>window.location='index.php?' + 'gp_name=' + '<?php echo $gname';?>'</script>";
}
}