Saving a user ID to MYSQL

Hi i have a MYSQL database which i need the logged in user to save information to. this is easy enough but i would like it to automatically save the users_id in the table also so that when i run a report on tables joined i can see who saved what.

Does anyone know how to do this? Below is what i have so far.. I can insert manually but would like the user_id to save from the logged in user.
Thank you in advance for any help.

function edit_rams(){
    include("inc/db.php");
    if(isset($_GET['edit_rams'])){
        $id=$_GET['edit_rams'];

        $get_op=$conn->prepare("SELECT * FROM rams WHERE id='$id'");
        $get_op->setFetchMode(PDO:: FETCH_ASSOC);
        $get_op->execute();
        $row=$get_op->fetch();

        echo"<h2>Edit Operative</h2><div class='cat'><div class='update'>
        <form class='edit_form' method='post' enctype='multipart/form-data'>
        <h2>Confimation</h2>
        <p>Are you sure you Want to complete this RAMS?</p>
        <p>By Agreeing to this you are declaring that you have read and understood everything contained within these RAMS</p>
       <center><button name='add_rams2'>Complete RAMS</button></center>
        </form><br /><br /><br /></div></div>";

if(isset($_POST['add_rams2'])){
            $ram_name=$_session['user(id)'];
            
            $add_rams2=$conn->prepare("INSERT into rams_1 (user_id, ram_id, signature)VALUES('$ram_name', '1', 'steve')");
            
if($add_rams2->execute()){
                echo"<script>alert('Operative Added Successfully')</script>";
                echo"<script>window.open('dashboard.php?test','_self')</script>";
                }else{
                    echo"<script>alert('Operative Not Added Successfully')</script>";
                    echo"<script>window.open('dashboard.php?test','_self')</script>";
                }
            }
    }
}`

Go to Source
Author: steven meadows