I have xml files for a whole bunch of data. I have managed to get them into a nice format and showing on an html page fine. I can even go backwards and forwards between xml files. To do this I simply use a $_GET['rec'] variable.
However, I've been trying to ALSO have things update on the page when the user selects (preferably just clicks on) an item in a <select> tag - populated from the XML file.
Below is my latest attempt at this (with the population of the <select>):
echo "<form id=v2p method=\"POST\"><select size = 5 onclick=\"javascript:document.v2p.submit();return false;\">";
$vars = $xmlDoc->getElementsByTagName('var');
foreach($vars as $var)
{
$varname = $var->getElementsByTagName('vaname')->item(0)->nodeValue;
echo "<option value=$varname>$varname</option>";
}
echo "</select></form>";
echo "<br/>";
$var2plot = $_POST['v2p'];
echo "<a>$var2plot</a>";
I get an "Undefined index: v2p" error on line 75 ($var2plot = $_POST['v2p']; ):
Please could someone show me a nice way to make it work...
Thanks in advance,
Dave