TY_BCA_AWT_SLIP 20_1



20.    Write PHP program to select list of subjects (use multivalued parameter) displays on next page.


HTML File
<html>
<head><title>Slip20
</title>
</head>
<form action=slip20.php method=get>
Select List of subjects
<select multiple name="subjects[]">
                 <option value="VB.NET">Vb.NET</option>
                 <option value="PHP">PHP</option>
                 <option value="JAVA">JAVA</option>
</select>
<input type=submit value="submit">

</form>
</html>
PHP File
<?php
                 echo "You selected subjects are";
echo "</br>";
foreach($_GET['subjects'] as $s)
{
                          echo "$s</br>";
}
                
?>

2 comments:

  1. When i run this program in xammp so tha PHP file is not working .i get error from foreach so plz tell me how to run this program
    g

    ReplyDelete
    Replies
    1. can u send the screenshot of error ??
      above code is working and tested.

      Delete

Note: only a member of this blog may post a comment.