Maybe its a stupid question, but what is right way to redirect user to the success page after form is saved in database?
I dont know why, but if I add action="done.php", than the form does not save data to my database.
I tried to add header ("location:/done.php"); it worked, but when I moved page to original server ( PHP 4 and MySQL 3.23.5 ) there is error when I am trying to send the form Warning: Cannot modify header information - headers already sent by ........
Here is my php code :
if(isset($_POST['submit']))
{
$name=$_POST['name'];
$email = $_POST['email'];
$company = $_POST['company'];
$adress = $_POST['adress'];
$post = $_POST['post'];
$phone = $_POST['phone'];
$sql="INSERT INTO tekstile_users (id, name, email, company, adress, post, phone)
VALUES
('', '$name','$email','$company', '$adress', '$post', '$phone')";
if (mysql_query($sql,$con)) {
header ("location:/done.php");
}
else {
echo "Something is wrong";
}
}//end of submit button
I fix it converting that .php file to UTF-8 without BOM .
Thanks all for suggestions!
I fix it converting that .php file to
UTF-8 without BOM.Thanks all for suggestions!