hi iam working on building a website for maintaining PCs, and if anyone get in my site asking for help, if i try to answer him the answer will go to the werong person, so please any help

<html>
<head>
<meta charset='utf-8'>
</head>
<body >
</body>
</html>
<?php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = 'root';
$con=mysql_connect("localhost","root","root");
// Check connection
if (!$con)
{
die("can not connect" . mysql_error());
}
mysql_select_db('newone') or die("can not find db"); 
if(isset($_GET['edit']))
{
$user_id=$_GET['edit'];
echo "$user_id";
$res=mysql_query("SELECT * FROM newone WHERE user_id='$user_id' ");
}
if(isset($_POST['save']))
{
$notes=$_POST['user_notes'];
$answer=$_POST['user_answer'];
$user_id=$_POST['user_id'];
echo "$user_id";
$sql="UPDATE newone SET user_notes='$notes' ,user_answer='$answer'  WHERE  user_id='$user_id' ";
$res=mysql_query($sql) or die("count update".mysql_error());
echo "<meta http-equiv=\"REFRESH\"content=\"0;url=justtry2.php\">";
}
echo "<table border='2' heigh='1740' width='1340' bgcolor='C8B478'>
<tr>
<th>الملاحظات</th>
<th>الجواب</th>
<th>المشكله</th>
<th>نوع اخر للعطل</th>
<th>نوع العطل</th>
<th>البريد الاكتروني</th>
<th>موقع اخر</th>
<th>الموقع</th>
<th>الاسم</th>
<th>التاريخ والوقت</th>
<th>الرقم</th>
</tr>";
while($row=mysql_fetch_array($res))
  {
  echo "<form method='post'  action='justedit.php'>";
  echo "<tr>";
 echo "<td> <input type=text  name='user_notes'  ></td>";
  echo "<td><input type=text   name='user_answer' > </td>";
  echo "<td>" . $row['user_problem'] . "</td>";
  echo "<td>" . $row['user_ectt'] . "</td>";
  echo "<td>" . $row['user_type'] . "</td>";
  echo "<td>" . $row['user_email'] . "</td>";
  echo "<td>" . $row['user_ect'] . "</td>";
  echo "<td>" . $row['user_location'] . "</td>";
  echo "<td>" . $row['user_name'] . "</td>";
  echo "<td>" . $row['join_date'] . "</td>";
  echo "<td>" . $row['user_id'] . "</td>";
  echo  "<td><input type='submit'   name='save'   value='save'></td>"; 
  echo "</tr>";
  echo "</form>";
  }
echo "</table>";
?>{

So, when you say "the answer will go to the werong person", do you mean the record gets entered to your database with the wrong user id?

It seems like there is more code to this that could be the problem, but is this really correct $user_id=$_GET['edit']; ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.