Salve a tutti ho un problema vorrei fare in modo che una volta collegato clicco sul profilo di una persona e li vorrei avere la possibilità di commentare il suo stato, il problema qual'è è che se clicco su commenta mi compare il mio profilo e invece dovrebbe rimanere sul suo profilo, la pagina è cosi:
non riesco a capire qual'è il problema, qualcuno può aiutarmi?, ciao grazie
PHP:
if(isset($_GET['user']) && !empty($_GET['user'])){
$user=$_GET['user'];
} else {
$user=$_SESSION['user_id'];
}
$my_id=$_SESSION['user_id'];
$id_utente = getuser($user, 'id');
$nome = getuser($user, 'nome');
$cognome = getuser($user, 'cognome');
$foto = getuser($user, 'foto');
$username=getuser($user, 'username');
$user_id=getuser($user, 'user_id');
PHP:
if(isset($_POST['submit']))
{
if(empty($_SESSION['content'] ) ||
strcmp($_SESSION['content'], $_POST['content']) != 0)
{
//$errors .= "\n The captcha code does not match!";
}
if(empty($errors))
{
//require_once('connection.php');
$content=$_POST['content'];
$commentid=$_POST['commentid'];
mysql_query("INSERT INTO comment(user_id, nome, cognome, content, foto, comsubid)VALUES('$my_id', '$nome', '$cognome', '$content', '$foto', '$commentid')");
}
}
PHP:
<?php
require_once('connect-inc.php.');
$result3 = mysql_query("SELECT commentid, user_id, nome, cognome, content, comsubid, foto FROM comment WHERE comsubid=0 AND user_id='$id_utente'");
while($row3 = mysql_fetch_array($result3))
{
$id=$row3['commentid'];
echo '<div id="maincomm">';
echo '<img src="'.$row3['foto'].'" width="70px" height="70px">';
echo '<br>'.$row3['nome'].' ';
echo ' '.$row3['cognome'].' ';
echo '<p>'.$row3['content'].'</p>';
echo '<p id="comm">'.'<a href="profile2.php?id='.$id.'&#link1">comment</a>'.'</p>';
$result4 = mysql_query("SELECT * FROM comment where comsubid='$id'");
while($row4 = mysql_fetch_array($result4))
{
echo '<div id="subcomm">';
echo '<img src="'.$row4['foto'].'" width="70px" height="70px">';
echo '<br>'.$row4['nome'].' ';
echo ' '.$row4['cognome'].' ';
echo '<p>'.$row4['content'].'</p>';
echo '<div class="clearfix"></div>';
echo '</div>';
}
echo '<div class="clearfix"></div>';
echo '</div>';
}
?>
<div class="clearfix"></div>
</div>
<a id="link1">
<form method="POST" name=""
action="profile2.php">
<table width="332" border="0" align="center">
<tr>
<td width="265">
<ul>
<?php
if(!empty($errors)){
echo "<li class='err'>".($errors)."</li>";
}
?>
</ul> </td>
<td width="57"> </td>
</tr>
<tr>
<td colspan="2">
<input type="hidden" name="nome" value="<?php echo $nome; ?>" />
<input type="hidden" name="cognome" value="<?php echo $cognome; ?>" />
<input name="commentid" type="hidden" value="<?php echo $_GET['id'] ?>">
Content:<br>
<textarea name="content" style="width: 316px;"></textarea>
</td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Submit" name='submit'></td>
</tr>
</table>
</form>
non riesco a capire qual'è il problema, qualcuno può aiutarmi?, ciao grazie