使用 PHP 注册网站后重定向到个人资料


redirect to profile after registering for website using php

我想在注册后将用户发送到那里的个人资料,但我没有得到输入文件不确定我做错了什么,但我在 els 语句中启动了一个会话,不确定这是否是写的,也许有人可以帮助我

<?php
//  set  database  connection
require("dbconfig.php");  

//  lets  get  our  posts //
$email = $_POST['email'];
$pass = $_POST['password'];
$bn = $_POST['bandname'];
$state = $_POST['state'];
$genre = $_POST['genre'];
$description = $_POST['description'];
$image = $_FILES['image'];
/// valid  image  types ///
$image_type = array("image/jpg","image/jpeg","image/bmp","image/gif","image/png");

///  folder  that  will  hold the  image
$imagepath = "images/";

$imagepath .= $image["name"];

// move the  file from the tmp  folder to the  image  folder
if (move_uploaded_file($image['tmp_name'], $imagepath)){
$foo = `mogrify -quality 92 -scale 500x $imagepath`;    
}   

//  insert  data into mysql 
    $sql = "insert into dbusers (email, password, bandname, state, genre,           description    , image)
                                                                                              values ('$email','$pass','$bn   ','$state','$genre','$description','".$image['name']        . "')";

if (!mysql_query($sql)){
 die('ERROR' . mysql_error());      
      }else {    
      $id=mysqli_insert_id($sql); // Get the associated ID number
                            // Set up a login session
    session_start();
    $_SESSION ['id'       ] = $id;
    $_SESSION ['bandname' ] = $bandname;
    $_SESSION ['password' ] = $password;
    header  ("Location:ympprofile.php?listid=$id");   
}    
?>

你需要改变

header  ("location:ympprofile.php?listid=$id");   

header  ("Location:ympprofile.php?listid=$id");   

标头函数的 Location 属性大写。

首先,您需要获取插入行的id,例如

$id=mysqli_insert_id($sql);
then 
header  ("location:ympprofile.php?listid=$id");