This topic is locked

Prevent Error message from displaying at top of window

10/7/2023 8:54:05 AM
PHPRunner General questions
author

I have the following code on button Server side to check if there is internet connecton. I have numbered the lines for easy reference.
1. $connected = @fsockopen("<a href='www.example.com'>www.example.com</a>;", 80); 2. If ($connected){ 3. $is_conn = true; 4. fclose($connected); 5. }else{ 6. $is_conn = false; 7. }So if there is internet, I send a mail after I update the record in the server. But if no internet I want to display a message to the user saying somthing like "record saved successfully but mail will not be sent".
But what I think happens is that, when line 1 fails because there is no internet, the following message is displayed at the top of the screen
img alt
But I dont want that. I simply want it to ignore the error and also not try to send email. And rather at Client After display a swal that says : "record saved successfully but mail will not be sent".
How can I achieve this?
Thank you