次のファイルがあります。何らかの理由で、JavaScript (PHP の「echo」タグ内) が機能しません。
HTML (index.php):
<form action="submit.php" method="post">
<div id="edit-box">
<INPUT type="submit" name="save-text" id="save-text" value="Save">
<textarea id="editor" name="editor">
<?php echo $content; ?>
</textarea>
</div>
</form>
PHP (submit.php):
<?php
include('connect-db.php');
$submit_date = date("Ymd");
$content = mysql_real_escape_string(htmlspecialchars($_POST['editor']));
$ip_address = getRealIPAddress();
if ($content != '') {
mysql_query("INSERT source SET submit_date='$submit_date', ip='$ip_address', content='$content'")
or die(mysql_error());
// The following line is not working! I need help here!
echo '<script type="text/javascript"> alert("Your file saved!");</script>';
mysql_close($connection);
}
?>
「submit.php」には、他の PHP または HTML スクリプト/タグはありません。古い PHP/MySQL API (PDO/MySQLi の代わりに) を使用していることは理解していますが、それは的外れです。