Advertisement
Guest User

Untitled

a guest
Feb 26th, 2013
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.33 KB | None | 0 0
  1. <?php
  2. $subjects=array("Math","Science","English","History");
  3. function createDropdown($arr, $frm) {
  4. echo '<select name="'.$frm.'" id="'.$frm.'"><option value="">Select one…</option>';
  5. foreach ($arr as $key => $value) {
  6. echo '<option value="'.$value.'">'.$value.'</option>';
  7. }
  8. echo '</select>';
  9. }
  10. ?>
  11.  
  12. <h2> "User Form 1" </h2>
  13. <form id="form1" name="form1" method="post" action="form2.php">
  14. <table cellpadding="3">
  15.  
  16. <tr><td>First Name:</td>
  17.     <td><input type="text" name="FirstName"></td>
  18. </tr>  
  19.    
  20. <tr><td>Last Name:</td>
  21.     <td><input type="text" name="LastName"></td>
  22. </tr>
  23.  
  24. <tr><td>Student ID:</td>
  25.     <td><input type="text" name="StudentID"maxlength='9'></input></td>
  26. </tr>
  27. <tr>   
  28.     <td>Grade:</td>
  29.     <td>
  30.         <input type="radio" name="grade" value="9">9</input>
  31.         <input type="radio" name="grade" value="10">10</input> 
  32.         <input type="radio" name="grade" value="11">11</input>
  33.         <input type="radio" name="grade" value="12">12</input> 
  34.     </td>
  35.    
  36.  
  37. <tr><td>Subject Mark:</td> 
  38. <td>
  39. <label for="frmsubjects"></label>
  40. <!--?php createDropdown($subjects, 'frmsubjects'); ?-->
  41. <?php
  42. //Array contents array Subjects :: value
  43. $Subjects = array('Select a Course','Math','Science','English','History');
  44.  
  45. //Values from Subjects array
  46. echo'<select name="Words">';
  47. //for each value of the array assign a variable name word
  48. foreach($Subjects as $word){
  49.     echo'<option value="'.$word.'">'.$word.'</option>';
  50. }
  51. echo'</select>';
  52. ?>
  53. </td>
  54. <td>
  55.     <select name = "mark">
  56.         <option value = "x"> Select a mark </option>
  57. <?php
  58. for ($i=0;$i<101;$i++)
  59.         {
  60.         echo "<option value=\"".$i."\">".$i."</option>";
  61.         }  
  62. ?>
  63.     </select>
  64. </td>
  65.  
  66.  
  67.  
  68.  
  69.  
  70. <tr><td>Subject Mark:</td> 
  71. <td>
  72. <label for="frmsubjects"></label>
  73. <!--?php createDropdown($subjects, 'frmsubjects'); ?-->
  74. <?php
  75. //Array contents array Subjects :: value
  76. $Subjects = array('Select a Course','Math','Science','English','History');
  77.  
  78. //Values from Subjects array
  79. echo'<select name="Words">';
  80. //for each value of the array assign a variable name word
  81. foreach($Subjects as $word){
  82.     echo'<option value="'.$word.'">'.$word.'</option>';
  83. }
  84. echo'</select>';
  85. ?>
  86. </td>
  87.  
  88. <td>
  89.     <select name = "mark">
  90.         <option value = "x"> Select a mark </option>
  91. <?php
  92. for ($i=0;$i<101;$i++)
  93.         {
  94.         echo "<option value=\"".$i."\">".$i."</option>";
  95.         }  
  96. ?>
  97.     </select>
  98. </td>
  99. </tr>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement