, , ,

When do you get two messages at the same time in php captcha form? how can you fix it?

Posted by

If you are learning PHP or making a PHP captcha form on the basis of crud operation. And if you’re clicking on a submit button then meanwhile two messages are arriving at the same time. you may see on the below-mentioned image then how you can fix it.

PHP Messages

I have a simple and quick solution for you, whenever you get this type of message in your PHP crud form then you have done a mistake in your if, and else function parts and if you put this kind of function at your php code which is mentioned over below code:

if(isset($_POST['submit'])){
  // checking for empty field
  if(($_POST['title'] == "") || ($_POST['details'] == "") || ($_POST['name'] == "") || ($_POST['date'] == "") || ($_POST['email'] == "") || ($_POST['phone'] == "")){
    echo"<small><b>Fill all fields..</b></small>";
  }
else{session_start();
$title=$_POST['title'];
$details=$_POST['details'];
$name=$_POST['name'];
$date=$_POST['date'];
$email=$_POST['email'];
$phone=$_POST['phone'];
$captcha=$_POST['captcha'];
if($_SESSION['CODE']==$captcha){
	$sql= mysqli_query($conn,"insert into wishform(title,details,name,date,email,phone) values('$title', '$details', '$name', '$date', '$email', '$phone')");
	echo "Thank you! wishes submitted successfully.";
}else{
	echo "<captcha>Please enter valid captcha code</captcha>";
}
}
}

I have applied it to my php code and it has really worked on me. I give you the assurance that it will really work on your php crud operation. if you will apply this code function then you will get the distinguish messages after applying it.

guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x