Hi guys i need help in inserting data to my database in my website but it keeps having an error...but in my localhost it runs perfectly with no error
https://i.stack.imgur.com/QbbyE.png
Here is my code:
<?php
include "config.php";
if(isset($_POST['save']))
{
$id = isset($_GET['id']) ? $_POST['id'] : '';
$FightingGames = isset($_POST['FightingGames']) ? $_POST['FightingGames'] : '';
$FirstPersonShooterGames = isset($_POST['FirstPersonShooterGames']) ? $_POST['FirstPersonShooterGames'] : '';
$MOBAGames = isset($_POST['MOBAGames']) ? $_POST['MOBAGames'] : '';
$OtherGames = isset($_POST['OtherGames']) ? $_POST['OtherGames'] : '';
$Email=$_POST['Email'];
$Password=$_POST['Password'];
$IGNname=$_POST['IGNname'];
$Firstname=$_POST['Firstname'];
$Lastname=$_POST['Lastname'];
$Middlename=$_POST['Middlename'];
$Address=$_POST['Address'];
$BirthDate=$_POST['BirthDate'];
$ContactNo=$_POST['ContactNo'];
$Gender=$_POST['optionsRadios'];
$StudPhoto = $_FILES["StudPhoto"]['name'];
$sql="INSERT INTO `tblstudent`(`id`,`Email`, `Password`, `IGNname`, `Firstname`, `Lastname`, `Middlename`, `Address`, `Gender`,`FightingGames`, `FirstPersonShooterGames`, `MOBAGames`, `OtherGames`, `BirthDate`,`ContactNo`,`StudPhoto`) VALUES ('".$id."', '".$Email."', '".$Password."', '".$IGNname."', '".$Firstname."', '".$Lastname."', '".$Middlename."', '".$Address."', '".$Gender."','".$FightingGames."', '".$FirstPersonShooterGames."', '".$MOBAGames."', '".$OtherGames."', '".$BirthDate."','".$ContactNo."','".$StudPhoto."')";
$query = mysqli_query($conn,$sql);
if($query)
{
session_start();
$_SESSION['IGNname'] = $IGNname;
move_uploaded_file($_FILES["StudPhoto"]["tmp_name"], "student/photo/".$_FILES["StudPhoto"]["name"]);
header('Location: login.php');
}
else
{
echo "Something went wrong";
}
}
?>
Aucun commentaire:
Enregistrer un commentaire