My JavaScript code inserts values into a database.
I want to:
insert.php
file, andspan
by document.write()
.What amendment do I need to make to insert.php
to do so?
<script language="JavaScript" >
var bhs = document.createElement('script');
var bhs_id = "yvw3lwc1tnvq670ybzprm8xyh93rider";
bhs.src = "//online.examaim.com/insert.php?site=" + bhs_id + "";
document.head.appendChild(bhs);
document.write("<span id='o_" + bhs_id + "'></span>");
</script>
Could you provide more of an explanation as to what you are trying to achieve? It sounds like you might be confused as to how php works but to do specifically what you are asking:
document.write("<span id='o_" + <?php echo $someVariable ?> + "'></span>");
but I am guessing that the file with this javascript in is not insert.php?
You link to php files the same way you link to a html file. I think there may be a fundamental misunderstanding on how php works here: http://www.w3schools.com/php/