I am just wondering on one thing that I cannot solve until now.
I have one php file, with the following code.
doInit.php
<?
include 'connect.php';
session_start();
if(isset($_SESSION['detailid'])){
$detailid = $_SESSION['detailid'];
$resutlinit=mysql_query("select Nama,Kelas,Ranking,Level,Exp,Sekolah from MsDetail where DetailID='$detailid'");
if(mysql_num_rows($resutlinit)!='0'){
$row = mysql_fetch_array($resutlinit);
$nama = $row['Nama'];
$kelas = $row['Kelas'];
$ranking = $row['Ranking'];
$level = $row['Level'];
$exps = $row['Exp'];
$sekolah = $row['Sekolah'];
}else echo("Nothing here, try to more detail on your code");
}else {header("location:index.html");}
?>
<script type="text/javascript">
var nama = "<?= $nama ?>";
var kelas = "<?= $kelas ?>";
var ranking = "<?= $ranking ?>";
var level = "<?= $level ?>";
var exps = "<?= $exps ?>";
var sekolah = "<?= $sekolah ?>";
//document.writeln(nama);
//document.writeln(kelas);
//document.writeln(ranking);
//document.writeln(level);
//document.writeln(exps);
//document.writeln(sekolah);
</script>
and I want to write the javascript file on my inside div.
This is what I wrote in my div HTML Editor.
<script type="text/javascript">
document.writeln(nama);
</script>
and this doesn't work.
I tried to add some src things on PHP File like
<script type="text/javascript" src="target.html"></script>
but it has no luck.
and I tried to add that src into the target html like
<script type="text/javascript" src="doInit.php"></script>
and this too is not working for me.
Any suggestion how to solve this? Thanks for attention :)
Sorry for editing after 2 answers are here.