WHY header(location) is not working


#1

after sending data into DB stays on the same on the same page , please help

[php]
if(isset($_POST[‘submit’])){

 $stmt = $connection->prepare("INSERT INTO advert (title, email, phone, place, options, name,  lastname,  message, kod ,  image, rodzaj, cena,  ip) VALUES (?, ?, ?,?, ?, ?,?, ?, ?,?, ?, ?,?)");

$stmt->bind_param(“sssssssssbsss”, $title, $email, $phone, $place, $options, $user, $lastname, $message, $randomString, $file, $rodzaj, $cena, $ip);

         $user=$_SESSION['login'];

$title=filter_var($_POST[‘title’], FILTER_SANITIZE_STRING);
$email=filter_var($_POST[‘email’], FILTER_SANITIZE_STRING);
$phone=filter_var($_POST[‘phone’], FILTER_SANITIZE_STRING);
$place=filter_var($_POST[‘place’], FILTER_SANITIZE_STRING);
$options=filter_var($_POST[‘options’], FILTER_SANITIZE_STRING);

          $lastname=filter_var($_POST['powiat'], FILTER_SANITIZE_STRING);
           $message=filter_var($_POST['message'], FILTER_SANITIZE_STRING);
          $rodzaj=filter_var($_POST['optradio'], FILTER_SANITIZE_STRING);
         $cena=filter_var($_POST['cena'], FILTER_SANITIZE_STRING);
          $length = 10;

$randomString = substr(str_shuffle(“0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ”), 0, $length);
$ip=$_SERVER[“REMOTE_ADDR”];
$file = addslashes(file_get_contents($_FILES[“image”][“tmp_name”]));

$stmt->execute();

$formcontent=" From: $imie \n Email: $email \n Wiadomosc: $message \n Kod: $randomString \n ";
$recipient = “$email”;
$mailheader = “From: $email \r\n”;

mail($recipient, $mailheader, $formcontent ) or die("Error!");

header(“Location: addimages.php”);

           }
          
     $stmt->close();     

}
[/php]


#2

I’m guessing it has something to do with this,

[php]mail($recipient, $mailheader, $formcontent ) or die(“Error!”);[/php]

“or die” is an old construct that should no longer be used.


#3

I knew it but i didn’t check :slight_smile: thank you so much
I have another small question
when I have login form, and its doesn’t matter if I user capital letters or small still login as daniel ( DANIEL) goes to the same account


#4

I don’t understand the question. Should the capitalization matter for the username?


#5

yes


#6

What is the database collation type? And the code you are using to match the username to the user input?