I have aske this once before with different peramiters and im not sure how to adjust the code to suit what I need it to do so once more here is the code

<?php
include 'conection.php';

$result = mysql_query("SELECT * FROM inventory")
    or die(mysql_error());

echo "<table border = '1'>";
echo "<tr><th>ID</th><th>Year</th><th>Make</th><th>Model</th>
<th>Milage</th><th>Description</th></tr>";
//keeps getting the next row untill no more exist
while($row = mysql_fetch_array($result))
    {
        //print out the contents of each row
        echo "<tr><td>";
        echo $row['id'];
        $refId = $row['id'];
        echo "</td><td>";
        echo $row['year'];
        echo "</td><td>";
        echo $row['make'];
        echo "</td><td>";
        echo $row['model'];
        echo "</td><td>";
        echo $row['mileage'];
        echo "</td><td>";
        echo $row['description'];
        echo "</td><td>";
        ?>
        <form action="picUploads.php" method="post"
enctype="multipart/form-data">
<input type="text" name="refID" value=<?php echo $refId; ?> /></td><td><input type="submit" name="submit" value="Select" />
        <?php
        echo "</td></tr>";
    }
echo "</table>";
?>

it all works just fine here, shows the propper refId and everything, its when I click the select button that things go wrong. The values are visible for testing purposes and will be changed to a hidden field once everything works properly. The select button sends the page viewer here,

<?php
session_start();
include 'conection.php';
if(isset($_SESSION['user_id']))
{
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Photo Upload</title>
</head>

<body  onUnload="window.addEventListener("unload", invalidateBackCache, true)>
<center><h1>UPLOAD PICTURES</h1></center>
<form action="upload.php" method="post"
enctype="multipart/form-data">
<input type="text" name="refID" value=<?php echo $_POST[$refId]; ?> /><br />
<label for="file">Filename:</label>
<input type="file" name="file" id="file" />
<br />
<label for="file">Filename:</label>
<input type="file" name="file" id="file" />
<br />
<label for="file">Filename:</label>
<input type="file" name="file" id="file" />
<br />
<label for="file">Filename:</label>
<input type="file" name="file" id="file" />
<br />
<label for="file">Filename:</label>
<input type="file" name="file" id="file" />
<br /><label for="file">Filename:</label>
<input type="file" name="file" id="file" />
<br />
<label for="file">Filename:</label>
<input type="file" name="file" id="file" />
<br />
<label for="file">Filename:</label>
<input type="file" name="file" id="file" />
<br />
<label for="file">Filename:</label>
<input type="file" name="file" id="file" />
<br />
<label for="file">Filename:</label>
<input type="file" name="file" id="file" />
<br />
<label for="file">Filename:</label>
<input type="file" name="file" id="file" />
<br />
<label for="file">Filename:</label>
<input type="file" name="file" id="file" />
<br />
<label for="file">Filename:</label>
<input type="file" name="file" id="file" />
<br />
<label for="file">Filename:</label>
<input type="file" name="file" id="file" />
<br />
<label for="file">Filename:</label>
<input type="file" name="file" id="file" />
<br />
<input type="submit" name="submit" value="Submit" />
</form>
</body>
</html>
<?php
}else
{
    echo "<br /><br /><br /><br />";
    echo "<strong><center>"."You Are Not Authorized To view This Page......<a href='admin.php'>Please Login First !!</a>"."</center></strong>";
}
?>

I am trying to figure out how to pass just the selected vehicles id through but it seems that all of the pulled ids are passed through. Any help on this would be greatlu apreciated.

Line 18: Change $_POST[$refId] to $_POST['refID'].
PS - only one instance of a specific HTML id should be used on a given page. In your second file, all your file inputs have the same id value. This is invalid HTML.

yes I am aware of the invalid html I am trying to get one thing working at a time, the id's are a simple fix i need to get the ref id working propperly, changing the code like that didn't fix the problem it is still passing all of the ids through and trying to use them all, I need to only post the one that is selected.

i am thinking a self populating switch statment may work i am just not sure where I would build it, should I start it in the while loop and have it add another case each time the while loop is cycled through? I am looking for oppinions here on how well you think my solution will work.

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.