First of all, I am really new in Javascript.
And I am doing most of my programming with php.

Currently I have a problem.

PHP Code:
if (isExistingShowtime($db)) {
    <script language="javascript"> 
        alert("this showtime has been already in my schedule");

} else {

As you see, the situation is that if this is the existed showtime, it will show alert and if the user clicks the OK of the alert, it should take him back to the calling page, but it doesn't work.

According to my code, if it's existing showtimes, it always goes back to the calling page, not even showing the alert.

How can I fix this problem?

Thanks in advance.