How do you assign a variable to a form from earlier php code to post to next php page?
<p>I am making a site that collects user comments via a submission form and then outputs them all onto a page where they can be rated from 1-10. I'm having trouble with the rating system part. </p>

<p>I have a form with radio buttons for my rating which sends by post the value via the 'SendRating.php'. I also want to send a previously used variable which is the 'id' that is tied to the particular comment and the particular rating. I have tried to use a hidden input to do this but I cannot seem to get the syntax correct and whatever I try I seem to get an error. </p>

<p>I will show you both php files I have:</p>

<pre><code>&lt;?php
    $con=mysqli_connect("host","me","pwd","base");
    // Check connection
    if (mysqli_connect_errno($con))
    {
        echo "Failed to connect to MySQL: " . mysqli_connect_error();
    }

    $query= "SELECT  id, comment, date_made, rating FROM table ORDER BY id DESC LIMIT 15";
    $result=mysqli_query($con, $query);
while ($row=mysqli_fetch_array($result))
    {
        $date=$row['date_made'];
        $id=$row['id'];
        $num_id=intVal($id);
        $current=$row['rating'];

        echo '&lt;div id="text" onpaste="return false"; oncut="return false"; readonly&gt;';
        echo '&lt;div id="text2"&gt;';
        echo "Submitted: ";
        echo date('l jS F Y H:i:s ',strtotime($date));echo '&amp;nbsp;'; echo '&amp;nbsp;'; 
        echo '&amp;nbsp;'; echo "No: ";  echo $row['id']; 
        echo '&lt;/div&gt;';

        echo '&lt;br&gt;'; 
        echo nl2br($row['comment']);
        echo '&lt;br&gt;'; echo '&lt;br&gt;'; 
        echo '&lt;/a&gt;';

        //FOOT
        echo '&lt;div &gt;'; 
        echo '&lt;form id="radio" name="input_rating" action="SendRating.php"     method="post" &gt;';
        echo '&lt;input type="hidden" name="id" value="'$id'" &gt;';
        echo '&lt;input  id="radio" type="radio" name="rating"  onclick="this.form.submit()" value="1"&gt;1';
        echo '&lt;input  id="radio" type="radio" name="rating" onclick="this.form.submit()" value="2"&gt;2';
        echo '&lt;input  id="radio" type="radio" name="rating" onclick="this.form.submit()" value="3"&gt;3';
        echo '&lt;input  id="radio" type="radio" name="rating" onclick="this.form.submit()" value="4"&gt;4';
        echo '&lt;input  id="radio" type="radio" name="rating"     onclick="this.form.submit()" value="5"&gt;5';
        echo '&lt;input  id="radio" type="radio" name="rating" onclick="this.form.submit()" value="6"&gt;6';
        echo '&lt;input  id="radio" type="radio" name="rating" onclick="this.form.submit()" value="7"&gt;7';
        echo '&lt;input  id="radio" type="radio" name="rating" onclick="this.form.submit()" value="8"&gt;8';
        echo '&lt;input  id="radio" type="radio" name="rating" onclick="this.form.submit()" value="9"&gt;9';
        echo '&lt;input  id="radio" type="radio" name="rating" onclick="this.form.submit()" value="10"&gt;10';

        echo '&amp;nbsp;'; echo '&amp;nbsp;'; echo '&amp;nbsp;'; echo  "Rating: ";
        echo '&amp;nbsp';
        echo  "$current";
        echo '&lt;/form&gt;';

        echo '&lt;/div&gt;';

        //END FOOT

         echo '&lt;/div&gt;'; 
         echo '&lt;p&gt;&lt;/p&gt;';
    }
?&gt; 
</code></pre>

<p>The form action is processed by the following (or would be if it was all working):</p>

<pre><code>&lt;?php
    $con2=mysqli_connect("host","me","pwd","base");

    // Check connection
    if (mysqli_connect_errno($con2))
    {
        echo "Failed to connect to MySQL: " . mysqli_connect_error();
    }
        $value=$_POST['rating'];
        $id=$_POST['id'];

    mysqli_query  ($con2, "UPDATE table SET totalraters = totalraters + 1 WHERE id='$id' ");
    mysqli_query  ($con2, "UPDATE table SET ratingsum = ratingsum + '$value' WHERE id='$id' ");

    $query2 = mysqli_query ($con2, "SELECT FROM table ratingsum, totalraters WHERE id = '$id' ");
    $result2 = mysqli_query($con2, $query2);
    $row2 =mysqli_fetch_array($result2);

    $ratingsum=$row2['ratingsum']; 
    $totalraters=$row2['totalraters'];
    $current = $ratingsum/$ratingtotal;
    mysqli_query ($con2, "INSERT INTO table rating VALUE '$current' WHERE id='$id' ");

    include ('/index.html')
?&gt;   
</code></pre>

<p>The include page should take the user back to the start page where the rating is updated. </p>

<p>ratingsum is the total added up of the ratings given and totalraters is the number of people who have rated. $current should be the average which gives the current rating. </p>

<p>The line I'm having trouble with at the moment is </p>

<pre><code>echo '&lt;input type="hidden" name="id" value="'$id'" &gt;';
</code></pre>

<p>I can't seem to get the id from one place to the other to be used in further queries. I get a syntax error for this line. 
Help gratefully received and believe I have tried everything but the correct solution!!
Please use procedural because I am new and can't understand object oriented at all...it makes my head hurt ;-)</p>
