I have two files, a main page scada.php and a sub-page site.php. Scada.php contains links like this:
<FORM action="site.php" method="post">
<li><td class="normal"><input type="image" name="sitename"
value="Dublin" src="radiotower.jpg" alt="Dublin" title="Dublin"/>
Dublin
</td></li>
</form>
Site.php accesses the name of the site here:
<?php
$site = $_POST["sitename"];
echo "<title id='title'>".$site."</title>";
?>
It then retrieves it with JS to show on the page and use in a database query:
<script>
var site = document.getElementById("title").innerHTML;
document.getElementById("alert").innerHTML = "<h2>"+site+"</h2>";
</script>
I checked the string length of sitename to make sure it's only including the characters of the name ("Dublin") and not the HTML title tags, and the length is correct at 6 characters.
This works fine in Chrome; everything smooth, runs as expected. In IE and Firefox, it issues an error that says "sitename" is an undefined index. I ran a vardump on the globals in site.php, and the result is that Chrome turns up 3 variables (sitename_x, sitename_y, and sitename). Firefox and IE only turn up two (sitename_x and sitename_y) and sitename is missing.
I've searched for $_POST problems that only occur in Firefox and IE and haven't found anything useful. Someone mentioned a submit button not getting pressed, but that's definitely not the issue here because the ONLY way to interact with the page is to press the input button. Where on earth is the variable sitename getting lost to??
EDIT: I was a bit unclear initially. The form contains multiple inputs, so this is more accurate:
<FORM action="site.php" method="post">
<li><td class="normal"><input type="image" name="sitename" value="Dublin"
src="radiotower.jpg" alt="Dublin" title="Dublin"/>
Dublin
</td></li>
<li><td class="normal"><input type="image" name="sitename" value="Temple"
src="radiotower.jpg" alt="Temple" title="Temple"/>
Temple
</td></li>
</FORM>