Solved

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

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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
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 create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

630 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