I want to get the user's (currently logged in) email and his/her uid from database table then insert it into another table. I have tried but i am getting blank results that is in to the uid and email.
<?php
session_start();
if(isset($_POST['button'])){
$bidamount = $_POST['bidamount'];
$email = $_SESSION['$u_email'];
$uid = $_SESSION['$u_uid'];
//TO ALERT SUBMISSION OF BLANK FIELDS(IT DOESN'T PREVENT SUBMISSION OF BLANK FIELD THOUGH)
if (!$bidamount){
echo "can't submit blank fields";
}
//TO CONFIRM YOU ARE CONNECTED TO YOUR DATABASE (OPTIONAL)
$connection = mysqli_connect('localhost', 'root', '', 'tickmill_auctions');
if ($connection){
header ("Location: ../Afterlogin.php?action=success");
}else{
die("connection failed");
}
//TO INSERT username and password from field to jossyusers database
$query = "INSERT INTO orders(bidamount,email,uid) VALUES('$bidamount','$email','$uid')";
$result = mysqli_query($connection, $query);
if(!$result){
die("OOPPS! query failed".mysqli_error($connection));
}
}
?>