Solved

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

Posted on 2010-09-23
2
395 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
change password links 7 72
Split in Javascript 5 30
PHP: concatenate query 12 30
jQuery - how can I set focus to first valid element in dropdown? 2 13
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
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…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

943 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

9 Experts available now in Live!

Get 1:1 Help Now