获取文档的id // php-javascript

so here is a html-list of my documents:

<form action="submitPage.html" method="post" onsubmit="submit();">
<img id="img1" src="inventory_images/berg.jpg" onclick="changeColor(this, 1);" />
<img id="img2" src="inventory_images/berg.jpg" onclick="changeColor(this, 2);" />

and JavaScript code, is used:

<script>
markedImage = 0; // The variable used for the submit;
function unmarkAll() {   
document.getElementById("img1").style.borderColor = "#000000";
document.getElementById("img2").style.borderColor = "#000000";
}
function changeColor(obj, markedId) {
unmarkAll();
obj.style.borderColor  ="#00FF00";
markedImage = markedId;
}
</script>
<script>
function submit()
{
    document.getElementById("markedImage").value = markedImage;
}
</script>

So, the user has the possibilty to select one picture and click "submit". Then he will be directed to "submitPage.html" :

<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
?>
<?php
if ($_SERVER['REQUEST_METHOD'] = "POST") {
    echo "Variables coming<br />";
} else {
    die("No Post Variables");
}
if ($_POST['markedImage'] = "POST") {
echo "Picture has been chosen<br />";
echo "This one:<br />";
$picture_id = $_POST['markedImage'];
echo $picture_id;
} else {
    echo "FAIL";
}
?>

I just want to display the "id" of the chosen image. ( display "img1" or "img2" ) What should i change? greetings

Instead of

<form action="submitPage.html" method="post" onsubmit="submit();">
<img id="img1" src="inventory_images/berg.jpg" onclick="changeColor(this, 1);" />
<img id="img2" src="inventory_images/berg.jpg" onclick="changeColor(this, 2);" />

try

<form action="submitPage.html" method="post" onsubmit="submit();">
<img id="img1" src="inventory_images/berg.jpg" onclick="changeColor(this.id, 1);" />
<img id="img2" src="inventory_images/berg.jpg" onclick="changeColor(this.id, 2);" />

so markedId will actually be the image id.