How to update a specific record in mysql from html button

       include ('D_Base_Connect.php');
       $r = "SELECT * FROM userfile WHERE status='Pending'";
      // $query = "SELECT * FROM userfile";
       $rs = mysql_query($r);
         while($row = mysql_fetch_array($rs)){
          echo "
          <tr> <form method='post' action='admininterface.php'>
              <td><center><button type='submit' name='submit'>Mark Received
              echo "</table>";


			$sr= $_POST['fileid'];
				$sql = mysql_query("UPDATE userfile Set status= 'Received' where fileid= '$sr'");

“fileid” is primary key of Table “userfile” and i want to update the field STATUS from PENDING TO RECEIVED throuh html form , thruough submit button but it giver error that "fileid " not found After I submit the form.

Ask yourself where you are naming the individual form elements. The answer of course is that you are not. You are also making one form per user so ask yourself how you are distinguishing between users. Again the answer is that you are not.

I could probably give you a working example but maybe the above hints will be enough after you research a bit on html forms.

And if you are following a tutorial then drop it. The mysql_ function have been completely removed in PHP 7. Find one that starts with PDO.

im totattly new to php and mysql i dont even know the functions and their working so please help me

I truly wish I could point you to a good Introduction to Web 2017 development using PHP 7+ on the backend resource but I just don’t know of any.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.