I'm storing the selectedIndex of each select box in hidden fields.
The problem I'm having is that values of the hidden fields in the URL when the new page is loaded are surrounded by plus signs for whatever reason....Can anyone explain what is going on? Please try running the code below to see what I mean. Thanks.
Sample.php
------------------
Code: Select all
<script>
function init()
{
var dIndex = document.getElementById("databaseNum").value;
document.getElementById("dbSelect").selectedIndex = dIndex;
var tIndex = document.getElementById("tableNum").value;
document.getElementById("tableSelect").selectedIndex = tIndex;
}
function chooseDatabase(index)
{
document.getElementById("databaseNum").value = index;
document.formsї0].submit();
}
function chooseTable(index)
{
document.getElementById("tableNum").value = index;
document.formsї0].submit();
}
</script>
<html>
<body onload="init()">
<form id="form1">
<table cellspacing="2" cellpadding="2" border=1>
<tr>
<td align="center">
<fieldset>
<legend>Available Databases</legend>
<select onChange="chooseDatabase(this.selectedIndex);" id="dbSelect">
<option> database 1 </option>
<option> datebase 2 </option>
<option> database 3 </option>
<option> database 4 </option>
</select>
</fieldset>
<input type="text" name="databaseNum" value=" <?php echo($databaseNum); ?> "/>
<fieldset>
<legend> Available Tables </legend>
<select onChange="chooseTable(this.selectedIndex);" id="tableSelect">
<option> table 1 </option>
<option> table 2 </option>
<option> table 3 </option>
<option> table 4 </option>
</select>
</fieldset>
<input type="text" name="tableNum" value="<?php echo($tableNum); ?> "/>
</td>
</tr>
</table>
</form>
</body>
</html>feyd |