I am saving a record to database. When there is an error in saving a pop up window will show. However a popup window shows in another page. I want the popup window shows on the current page.

echo "<script type='text/javascript'>alert(\"Error saving record(s). Please Try Again!\")</script>";

I try this one

echo "<script type='text/javascript'>alert(\"Error saving record(s). Please Try Again!\")</script>";
header("location: regSignUp.php");

But the popup window will not show. Help please. Thank You.

The popup window doesn't display because you're outputting the code, but then redirecting the user to another page.

You will need to modify your code to check for an error, and display the popup OR perform the redirect.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.