I solve it this type of issue with Event Rocket Plugin.
That actually like it
$attendees = eventrocket_rsvp()->attendance( $_POST[‘event_id’] );
Here I check with , event_id is empty or not 🙂
But original solution I take from stackoverflow :
That is to check with id is empty or not
Use empty() to check if it is available. Try with –
will generate the error if host is not present here