php alert message code example

Example 1: alert in php

echo '<script>alert("Message")</script>';

Example 2: alert in php

// This is in the PHP file and sends a Javascript alert to the client
$message = "Something";
echo "<script type='text/javascript'>alert('$message');</script>";

Example 3: allert in php

// This is in the PHP file and sends a Javascript alert to the client
$message = "wrong answer";
echo "<script type='text/javascript'>alert('$message');</script>";

Example 4: alerta con php

echo '<script language="javascript">alert("juas");</script>';

Example 5: alert js in php

javascript:alert('Email enviado com Sucesso!');
javascript:window.location='index.php';

Tags:

Php Example