I would be very grateful if somebody would take the time to read my code and could tell me a way to put variable $kakka in the script below, so that it works. As of now variable $kakka has no value because the php code is down there. Sorry I understand nothing about jQuery but I need this function to work.
Markup and jQuery
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
var refreshId = setInterval(function()
{
$('#puu').fadeOut("slow").text($kakka).fadeIn("slow");
}, 5000);
</script>
</head>
<body>
PHP
<?php
$rs = mysql_query("SELECT * FROM users WHERE id='$_SESSION[user_id]'");
while
($row= mysql_fetch_array($rs))
{$starter= $row['id'];
$user_name= $row['user_name'];}
$starterID=$starter;
$companyID=$_GET['id'];
$input = $_POST['viesti'];
date_default_timezone_set('Europe/Helsinki');
$timestamp = date('h:i', time());
$file = $companyID." and ".$starterID.".txt";
if (file_exists($file)) {
$kakka = $companyID." and ".$starterID.".txt";
} else {
$kakka = $starterID." and ".$companyID.".txt";
}
$current = file_get_contents($kakka);
if(isset($_POST['viesti']) && $_POST['viesti'] != null){
$currents= $current. "<b>$user_name</b> <br> $input $timestamp\n<br>";
$shipuli= "<b>$user_name</b> <br> $input $timestamp\n<br>";
file_put_contents($kakka, $currents);
}
echo '<div id="puu">'.$current.$shipuli.'</div>';
?>