Solved

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

Posted on 2010-09-23
2
399 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Suggested Solutions

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

734 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