hi...

i m trying to get values of more then one select box on same page..

i am showing list of all users with select box..so per user there is one select box...

i want to get the value of all select box...which is select or not select...

here is my code...

include '../dbconnect.php'; 

$result = mysql_query("SELECT MatriID,Email,Name,Gender,Regdate,Status FROM user where Status = 'Active'  LIMIT $from, $max_results "); 

$nomod = mysql_num_rows($result);

<table width="98%" border="0" align="center" cellpadding="4" cellspacing="0">
			 
                <tr>
                  <td width="4%" bgcolor="#FFFFCC" class="HeadText1">&nbsp;</td>
                  <td width="8%" bgcolor="#FFFFCC" class="HeadText1"><strong>ID</strong></td>
                  <td width="17%" bgcolor="#FFFFCC" class="HeadText1"><strong>Email</strong></td>
                  <td width="17%" bgcolor="#FFFFCC" class="HeadText1"><strong>Name</strong></td>
                  <td width="10%" bgcolor="#FFFFCC" class="HeadText1"><strong>Gender</strong></td>
                  <td width="15%" bgcolor="#FFFFCC" class="HeadText1"><strong>Reg On</strong></td>
                  <td width="13%" bgcolor="#FFFFCC" class="HeadText1"><strong>Status</strong></td>
                  <td width="16%" bgcolor="#FFFFCC" class="HeadText1"><strong>Full View </strong></td>
				  <td width="16%" bgcolor="#FFFFCC" class="HeadText1"><strong>Plan </strong></td>
				  <td width="16%" bgcolor="#FFFFCC" class="HeadText1"><strong>Moderators </strong></td>
                  </tr>
				 <?php while($row = mysql_fetch_array($result)){ ?>
                <TR bgcolor="#FFFFFF" onMouseOver="this.bgColor='gold';" onMouseOut="this.bgColor='#FFFFFF';">
                  
				  <td class="smalltextgrey">&nbsp;</td>

                  <td class="smalltextgrey"><?php echo $row['MatriID']?></td>
                  <td class="smalltextgrey"><?php echo $row['Email']?></td>
                  <td class="smalltextgrey"><?php echo $row['Name']?></td>
                  <td class="smalltextgrey"><?php echo $row['Gender']?></td>
                  <td class="smalltextgrey"><?php echo $row['Regdate']?></td>
                  <td class="smalltextgrey"><?php echo $row['Status']?></td>
                  <td class="smalltextgrey"><a href="viewprofile.php?ID=<?php echo $row['MatriID']?>">View</a></td>
				  <td class="smalltextgrey">
				  	<select name="plan[<?php echo $row['MatriID']; ?>]">
						<option value="">Select Plan</option>
					<?php
						$plan = mysql_query("select * from plan");
						$noplan = mysql_num_rows($plan);
						
						while($planrow = mysql_fetch_array($plan))
						{ ?>
							<option value="<?php echo $planrow['planid'] ?>"><?php echo $planrow['planname'] ?></option>
					<?php	}
					?>
					</select>
				  </td>
				  
				  <td class="smalltextgrey">
				  	<select name="mod[<?php echo $row['MatriID']; ?>]" onchange="func(this);">
						<option value="">Select Moderator</option>
					<?php
						$mod = mysql_query("select * from moderators");
						$nomod = mysql_num_rows($mod);
						
						while($modrow = mysql_fetch_array($mod))
						{ ?>
							<option value="<?php echo $modrow['modid'] ?>"><?php echo $modrow['username'] ?></option>
					<?php	}
					?>
					</select>
				  </td>
                  </tr>
                <tr>
                  <td height="2" colspan="10" background="images/dot.gif" class="smalltextgrey"></td>
                  </tr>
				
				<?php }  ?>
              </table>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="2">
                <tr>
                  <td><div align="right">
                    <input name="Submit" type="submit" class="green-button" value="Assign Refral" />
                  </div></td>
                </tr>
              </table>

i want to validate that when user click on assign refral and if user didnt select any select box then it shows msg to select at least one select box..

i want to validate it with javascript or php ....

finally i got solution for this...
:D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.