Link to home
Start Free TrialLog in
Avatar of Bruce Gust
Bruce GustFlag for United States of America

asked on

How can I use an alert box that allows user to either continue or kill the form submission?

Here's my PHP:

$amber = "select id from students where first_name='$first_name' and last_name='$last_name'";
$amber_query=mysqli_query($cxn, $amber)
or die("Amber didn't make it.");
$amber_count=mysqli_num_rows($amber_query);
	if($amber_count>0)
	{
	//you've got someone with the same first and last name, check to see if the family_id select box was utilitzed
		if(isset($_POST['family_id'])&&trim($_POST['family_id'])<>"")
		//they chose a last name, so that means they're getting ready to duplicate somebody
		{
		header("Location:student_duplicate.php");
		exit();
		}

        RIGHT HERE - I want to put a Javascript alert box that tells the user they're getting ready to potentially add a duplicate entry. It may not be, so I want to give the user to either continue with the submission, or kill it. How?


	}

Open in new window

SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Bruce Gust

ASKER

Ray, I think I'm going to go with your wisdom, although the other suggestions are things that I'll stash away for other situations.

The problem is that the alert, while it would normally be cut and dry, has to have the ability to communicate with the server like you pointed out. Hence, I'm going to punt this approach and go with something else.

Thanks!
I think you'll get better results faster that way!