SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Mar 2011
    Posts
    173
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help in hidden value'..

    Hi,

    How can i get the value of $row['CatName'] without changing the value of in my option.
    I have a script to linked the two dropdown box..

    Thanks.
    This is my code..

    Code HTML4Strict:
     
     <script type="text/javascript" charset="utf-8">
      $(function() {
     
        /* For jquery.chained.js */
        $("#subcat").chained("#Cat");
      });
      </script>


    Code PHP:
     
    	<?php
    		echo'<tr>';
    			echo'<td align="right"><b>Category <font color=red>*</font>: </b></td>';
    			echo '<td>';
    			echo '<select id="Cat" name="Cat">';
    					echo '<option value=""></option>';
    					$cat=mssql_query("Select * from tblCat");
    					while($row=mssql_fetch_assoc($cat)){
    					echo "<option value='".$row['Catid']."' >".$row['CatName']."</option>";
    					}
     
    					echo '</select>';
    			echo'</td>';
    		echo'</tr>';
     
    		echo'<tr>';
    			echo'<td align="right"><b>Subcategory : </b></td>';
    			echo '<td>';
    			echo '<select id="subcat" name="subcat">';
    				echo '<option value=""></option>';
    				$Subcat=mssql_query("Select * from vw_SubCategory");
    				while($row=mssql_fetch_assoc($Subcat)){
    				echo "<option value='".$row['SubCatName']."' class='".$row['Catid']."' >".$row['SubCatName']."</option>";
    				}
    				echo '</select>';
    			echo'</td>';
    		echo'</tr>';		
    		?>

  2. #2
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,198
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Something like this??

    Code JavaScript:
    $(function() {
        alert($('select[name="Cat"]:selected').text());
    });


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •