How to trigger an alert in Javascript from PHP
<p>PHP newbie here...</p>

<p>I am trying to trigger an alert in JavaScript from PHP, but it doesn't seem to work. :</p>

<pre><code>if(isset($_POST['save-text'])){

        // get form data, making sure it is valid
        $submit_date = date('Y-m-d H:i:s');
        $content = mysql_real_escape_string(htmlspecialchars($_POST['editor']));

        $new_url = 'example.com/' . $key;
        echo "&lt;script&gt;alert('$new_url');&lt;/script&gt;";

        // build query
        mysql_query("INSERT INTO `source`(`id`, `key`, `submit_date`, `ip`, `content`) VALUES (null, '$key','$submit_date','$ip','$content')")
        or die(mysql_error());


    }
</code></pre>
