Solution:
<html>
<title>List of Subject</title>
<body>
<form method=get action="">
Select Subject :<br>
<input type=checkbox name=c1[] value=c <?php if(in_array('c',$_GET['c1'])) echo "checked";?>>C<br>
<input type=checkbox name=c1[] value=c++ <?php if(in_array('c++',$_GET['c1'])) echo "checked";?>>C++<br>
<input type=checkbox name=c1[] value=java <?php if(in_array('java',$_GET['c1'])) echo "checked";?>>JAVA<br>
<input type=checkbox name=c1[] value=php <?php if(in_array('php',$_GET['c1'])) echo "checked";?>>PHP<br>
<input type=checkbox name=c1[] value="data structure" <?php if(in_array('ds',$_GET['c1'])) echo "checked";?>>DATA STRUCTURE<br>
<input type=submit name=s value=Submit><br>
</form>
</body>
</html>
<?php
if(array_key_exists('s',$_GET))
{
$sub=join(' ',$_GET['c1']);
echo "You Selected: <br>$sub<br>";
}
?>
0 Comments