Veeris
Veeris

Reputation: 5

Redirect to Previous Page After Message

I want to go back to previous page after pressing "OK" on the function message prompted.

Php Code

function function_alert($message) { 
  
    // Display the alert box  
    echo "<script>alert('$message');
    document.location='javascript://history.go(-1)';
    </script>";
    } 

    // Function call 
    function_alert("This email has already subscribed");
 }

Alert Box

Thank you so much!

Upvotes: 0

Views: 822

Answers (1)

Jerson
Jerson

Reputation: 1745

Tried this

function function_alert($message) { 
    echo "<script>
          alert('$message')
          history.back()
          </script>";
}

Upvotes: 1

Related Questions