This code is a part my webpage:
<span onclick=alert('Name:$commenter_name <br>Email:$commenter_email <br> Rate:$commenter_rate <br>Comment time:$currentdate <br>Comment:$commenter_comment')>$commenter_name:$commenter_comment
<span class='post_time'>$currentdate</span>
</span>
The JavaScript alert is not working.
I want to make this code working, without using any double quotes.
Here's my whole PHP code:
<?php
if (isset($_POST['post'])){
$commenter_name = $_POST["commenter_name"];
$commenter_email = $_POST["commenter_email"];
$commenter_rate = $_POST["commenter_rate"];
$commenter_comment = $_POST["commenter_comment"];
$currentdate = date('d F Y');
$fianl = "Name:$commenter_name <br>Email:$commenter_email <br> Rate:$commenter_rate <br>Comment time:$currentdate<br>Comment:$commenter_comment";
$filename = getcwd() . "/Comma comments.php";
$line_i_am_looking_for = 2;
$lines = file( $filename , FILE_IGNORE_NEW_LINES );
$lines[$line_i_am_looking_for] = "
<tr>
<td>
<span onclick=alert('$fianl')>$commenter_name$commenter_comment
<span class='post_time'> $currentdate </span>
</span><hr><br>
</td>
</tr>";
file_put_contents( $filename , implode( "\n", $lines ) );
}
?>
Please help