Salve
Devo passare l'id tra due pagine, nel caso $id_candidato.
non capisco perchè ricevo
"Notice: Undefined index: idca in C:\Programmi\EasyPHP5.3.0\www\sito\prova\commenta. php on line 48"![]()
![]()
Codice PHP:
echo"<td>"."[url='commenta.php?idca=$id_candidato"."']"."Commenta" . "[/url]</td>";
Codice PHP:
<?php
session_start();
if ($_SESSION['login'] != "ok") {
header("Location: login_error.php");
exit();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Benvenuto albergatore</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="commenta.php">
<table width="342" border="1" cellspacing="1" cellpadding="0">
<tr>
<td>Commento</td>
<td><label>
<textarea name="commento" id="commento" cols="45" rows="5"></textarea>
</label></td>
</tr>
<tr>
<td>Voto</td>
<td><select name="select" id="select">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="5">4</option>
</select></td>
</tr>
<tr>
<td width="110"></td>
<td width="223"><label>
<input type="submit" name="commenta" id="commenta" value="Commenta" />
</label></td>
</tr>
</table>
</form>
<?php
if(isset($_POST['commenta']))
{
$id_candidato = $_GET['idca'];
$commento = $_POST['commento'];
$voto = $_POST['select'];
include 'db.inc.php';
$sql="INSERT INTO commenti (id_candidato, commento, stelle)
VALUES
('$id_candidato','$commento','$voto')";
if (!mysql_query($sql))
{
die('Errore: ' . mysql_error());
}
echo "Il commento è stato aggiunto";
}
?>
</body>
</html>![]()
grazie