Solved

JAVASCRIPT/PHP -- A way to display a alert then process a header("Location:..")?

Posted on 2010-09-23
2
393 Views
Last Modified: 2012-06-21
The script I am working on is rather complicated but I do know it processes after clicking save,  The thing is, it normally scans for issues and changes and edits them, However, I want it to display an error, and then it would head back to the original page. Something like, for example, in php/javascript:

echo "<script>alert('mailto: href links cannot be a personal email address. Please contact us for additional info');</script>";
header("Location: http://linkhere.com");


What is ending up happening is the header is processed and the alert never gets displayed. Is there a way to HALT continuation of the script until I hit OK easily?
0
Comment
Question by:Valleriani
2 Comments
 
LVL 10

Accepted Solution

by:
bugada earned 500 total points
ID: 33743042
Why are you using header?
Normally your are not allowed call header() after an echo

Change your code as follows

echo "<script>alert('mailto: href links cannot be a personal email address. Please contact us for additional info');document.location.href='http://linkhere.com';</script>";

0
 
LVL 7

Author Closing Comment

by:Valleriani
ID: 33743312
Ahh okay, thanks for explaining that!
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
PHP and Soap 3 30
google sheets dynamically calculate days between two dates 10 28
Creating Image Thumbnails Using PHP 3 16
onOpen 14 43
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
This article discusses how to create an extensible mechanism for linked drop downs.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now