Unexpected Characters in Action/Value tag

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
MuzzledKestrel
Forum Newbie
Posts: 2
Joined: Tue Feb 08, 2005 11:13 pm

Unexpected Characters in Action/Value tag

Post by MuzzledKestrel »

I'm trying to create two dynamically loaded select boxes, one for a database, and the other for its respective tables. Depending on which table is selected, I will list all the records in that particular table. Ideally, when I change the selectedIndex on one of the select boxes it should reload the page and display a new set of records for the new table.

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()
   &#123;
      var dIndex = document.getElementById("databaseNum").value;
      document.getElementById("dbSelect").selectedIndex = dIndex;  

      var tIndex = document.getElementById("tableNum").value;
	document.getElementById("tableSelect").selectedIndex = tIndex;
   &#125;   
 
   function chooseDatabase(index)
   &#123;
      document.getElementById("databaseNum").value = index; 
	document.forms&#1111;0].submit();
   &#125;

   function chooseTable(index)
   &#123;
      document.getElementById("tableNum").value = index; 
	document.forms&#1111;0].submit();
   &#125;
</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 | :roll:
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

the pluses are from the spaces you have around each value.
MuzzledKestrel
Forum Newbie
Posts: 2
Joined: Tue Feb 08, 2005 11:13 pm

Post by MuzzledKestrel »

Whoa! That's wild! Thanks for answering my question.
Post Reply