完整代码如下:
<html> <head><title>checkbox select取值_www.jb200.com</title> </head> <body > <?php $e_ary=array('PHP','C++') ?> <form name="form1" action="testsubmit.php" method="post"> <input name="choose[]" type="checkbox" value="PHP" <?php if(is_array($e_ary)){ echo in_array('PHP',$e_ary)?'checked':'';} ?>>PHP <input name="choose[]" type="checkbox" value="VB" <?php if(is_array($e_ary)){ echo in_array('VB',$e_ary)?'checked':'';} ?>>VB <input name="choose[]" type="checkbox" value="C++" <?php if(is_array($e_ary)){ echo in_array('C++',$e_ary)?'checked':'';} ?>>C++ <select name=select[] multiple> <option value="PHP"<?php if(is_array($e_ary)){ echo in_array('PHP',$e_ary)?'selected':'';} ?>>PHP</option> <option value="VB" <?php if(is_array($e_ary)){ echo in_array('VB',$e_ary)?'selected':'';} ?>>VB</option> <option value="C++" <?php if(is_array($e_ary)){ echo in_array('C++',$e_ary)?'selected':'';} ?>>C++</option> </select> <input name="submit" type="submit" value="submit"> </form> </body> </html>