Quando vado in home.php le variabili mi vengono stampate a dovere (nom,cog,email,code...) mentre quando ricarico la pagina mi viene dato errore.
Codice PHP:
<!DOCTYPE HTML PUBLIC>
<html>
<head>
<title>
HOME
</title>
<link rel='icon' href='http://127.0.0.1:8888/immagini/favicon.ico'/>
<style type'text/css'>@import 'style.css';</style>
</head>
<body>
<?php
if (isset($_POST['home'])) {
session_start();
$nom = $_SESSION['nome'];
$cog = $_SESSION['cognome'];
$email = $_SESSION['email'];
$code = $_SESSION['codice'];
} else {
include 'door.php';
}
include 'connection.php';
if (isset($_POST['comment'])) {
$text = $_POST['comment'];
$con = mysql_connect('localhost','root','')
or die ('Errore di connessione');
mysql_select_db('noteit')
or die ('Dati non presenti');
$date = (date('d-m-Y'));
$time = (date('G:i:s'));
$query = mysql_query("SELECT * FROM utenti WHERE EMAIL='".$email."' AND CODE='".$code."'");
$insert = mysql_query("INSERT INTO home VALUES ('','".$nom."','".$cog."','$date','$time','$text')");
} else {
$text = null;
}
$tab = "<div id='box7' class='centro2 testo c1 cb2' align='justify'>
$text
</div>
<div>$nom</div>
<div>$cog</div>";
echo $nom.$cog.$email.$code;
?>
<div id='box1' class='centro1 testo c1 cb2 cb bs'>
<div id='title1'>
<div id='noteit'>
noteit
</div>
</div>
<div id='box4' class='testo c1 cb2'>
</div>
<div id='box5' class='testo c1 cb2'>
<span>
<input
type='submit'
name='home'
value='Home'
class='btn0 testo c1 cb2'
onmouseout="this.className = 'btn0 testo c1 cb2';"
onmouseover="this.className = 'btn1 testo c2 cb1';"
onclick="location.href=('home.php');"/>
</span>
<span>
<input
type='submit'
name='profilo'
value='Profilo'
class='btn0 testo c1 cb2'
onmouseout="this.className = 'btn0 testo c1 cb2';"
onmouseover="this.className = 'btn1 testo c2 cb1';"/>
</span>
<span>
<input
type='submit'
name='info'
value='Info'
class='btn0 testo c1 cb2'
onmouseout="this.className = 'btn0 testo c1 cb2';"
onmouseover="this.className = 'btn1 testo c2 cb1';"/>
</span>
<form action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" method='POST'>
<div id='box6'>
<div style='margin: 5% 0 0 0'>
Ora cosa stai pensando?
</div>
<textarea id='textarea1'
class='testo c1 cb2'
name='comment' maxlength='500'></textarea>
<input
type='submit'
name='invia'
value='Invia'
class='btn0 testo c1 cb2'
style='float: right; margin: 5px 0 0 0'
onmouseout="this.className = 'btn0 testo c1 cb2';"
onmouseover="this.className = 'btn1 testo c2 cb1';"/>
</div>
<?php
if ($text!='') {
echo $tab;
} else {
}
?>
</form>
</div>
</div>
</html>