-2

My question is pretty simple, i have a php code :

$var_here = "<script type="text/javascript">document.write("9")</script>";

$result_comment_submit = "INSERT INTO feed_comment_" . $var_here . " (full_name,comment,date_time)" .  " VALUES('$commenter_name','$commenter_comment',DATE_FORMAT(NOW(),'%h:%i %p,  %W %M %e'))";

(it's a simple example)
I want $var_here to display a 9 in the 2nd variable.
So, would document.write() be able to do that for me.

Mihir Ujjainwal
  • 140
  • 2
  • 13

1 Answers1

1

Yes it will work as per your expectation..run below code..for testing purpose removed last string..

<?php
$var_here = "<script type='text/javascript'>document.write('9')</script>";
echo $result_comment_submit = "INSERT INTO feed_comment_" . $var_here . "";
?>
Prashant M Bhavsar
  • 1,136
  • 9
  • 13