<?php
include 'connection.php';
session_start();
$noteinfo=array();
$noteinfo['note']=$_POST['note'];
$_SESSION['noteinfo']=$noteinfo;
if (isset($_POST['submit'])) {
if (empty($_POST['note'])) {
echo "Dobavete Komentar";
}if (!empty($_SESSION['noteinfo'])) {
$check=mysqli_escape_string($conn,$_SESSION['userinfo']['fname']);
$sql = "INSERT INTO users (user_fname,user_mname,user_lname,user_login,user_email,user_phone) VALUES ('$_SESSION['userinfo'][0]}','{$_SESSION['userinfo'][1]}','{$_SESSION['userinfo'][2]}','{$_SESSION['userinfo'][3]}','{$_SESSION['userinfo'][4]}','{$_SESSION['userinfo'][5]}')";
$sql1= "INSERT INTO addresses (address_line_1,address_line_2,address_zip,address_city,address_province,address_country) VALUES ('$_SESSION[adr1]','$_SESSION[adr2]','$_SESSION[zip]','$_SESSION[city]','$_SESSION[provinciq]','$_SESSION[durjava]')";
$sql2="INSERT INTO notes (note_text) VALUES ('$_SESSION[note]')";
if (mysqli_query($conn,$sql)) {
echo "Added";
if (mysqli_query($conn,$sql1)) {
echo "Added";
if (mysqli_query($conn,$sql2)) {
echo "Added";
header("refresh:3 ; url=profile.php");
}
}
}else{
echo "Error";
}
}else{
header("refresh:1 ; url=zapiski.php");
}
?>
When i complete my 3 forms for users info,i store them in sessions array and after the third step i want to add the whole information from the arrays in my Database.But when i click the submit button,my db is filling only with ID's and no data.
session_start();
$userinfo=array();
$userinfo['fname']=$_POST['Fname'];
$userinfo['mname']=$_POST['Mname'];
$userinfo['lname']=$_POST['Lname'];
$userinfo['login']=$_POST['login'];
$userinfo['email']=$_POST['email'];
$userinfo['phone']=$_POST['phone'];
$_SESSION['userinfo']=$userinfo;
This is the first array,just like the other 2 .