Hello I'm working with PHP.At this moment i have just inserted data in database by php code.Just name and email + submit. But i want when i will click on submit then it will back to homepage.As far i know i did true code. Please check
$conn = new mysqli('localhost','root','','ajx');
$name = $_POST['name'];
$email = $_POST['email'];
if(empty($name) || empty($email)){
echo "<h3 style ='color:red; text-align:center;'>Filed must not be empty</h3>";
}else{
$sql = "INSERT INTO user(name,email) VALUES('$name','$email')";
$conn-> query($sql);
echo "Data insert Okay";
header("location : index.php");
}
IN THE FRONT END SHOWING THIS MESSAGE
Server error!
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script.
If you think this is a server error, please contact the webmaster.
Error 500
localhost Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/7.1.4
Aucun commentaire:
Enregistrer un commentaire