Advertisement
Guest User

Untitled

a guest
Feb 1st, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.54 KB | None | 0 0
  1. <?php
  2. //require_once 'header.php';
  3. require_once 'dbConnect.php';
  4. session_start();
  5.  
  6. $salutationQuery = mysqli_query($conn,"SELECT * FROM salutation_main");
  7. $genderQuery = mysqli_query($conn,"SELECT * FROM gender_main");
  8. $countryQuery = mysqli_query($conn,"SELECT * FROM countries ORDER BY CM_NAME ASC");
  9. $institutionQuery = mysqli_query($conn,"SELECT * FROM r_university ORDER BY RU_NAME ASC");
  10. $industryQuery = mysqli_query($conn,"SELECT * FROM r_industry ORDER BY RI_NAME ASC");
  11.  
  12. $userID = $_SESSION['userID'];
  13. // $getProfileQuery = "SELECT
  14. // a.AP_USER_ID,
  15. // a.AP_FIRST_NAME,
  16. // a.AP_LAST_NAME,
  17. // a.AP_AFFILIATION,
  18. // a.AP_PHONE_NO,
  19. // a.AP_MAILING_ADDRESS,
  20. // a.AP_COUNTRY,
  21. // c.SM_DESC,
  22. // d.UL_EMAIL_ADDRESS,
  23. // e.CM_NAME
  24. // FROM
  25. // applicant_profile AS a ,
  26. // salutation_main AS c ,
  27. // user_login AS d,
  28. // countries AS e
  29. // WHERE
  30. // a.AP_SALUTATION = c.SM_REF AND
  31. // d.UL_USER_ID = a.AP_USER_ID AND
  32. // e.CM_ID = a.AP_COUNTRY AND
  33. // a.AP_USER_ID = '$userID'";
  34.  
  35. $getProfileQuery="select * from name_salutation where UL_USER_ID=".$userID." limit 1";
  36. $getProfile_res = mysqli_query($conn,$getProfileQuery);
  37. $profile=mysqli_fetch_array($getProfile_res);
  38.  
  39. //var_dump($profile);die;
  40. $salutations = $profile['SM_DESC'];
  41. $fname = $profile['AP_FIRST_NAME'];
  42. //$mname = $profile['AP_MIDDLE_NAME'];
  43. $lname = $profile['AP_LAST_NAME'];
  44. //$initial = $profile['AP_INITIALS'];
  45. $affiliation = $profile['AP_AFFILIATION'];
  46. $email = $profile['UL_EMAIL_ADDRESS'];
  47. //$address = $profile['AP_MAILING_ADDRESS'];
  48. $phone = $profile['AP_PHONE_NO'];
  49. //$fax = $profile['AP_FAX_NO'];
  50. $country = $profile['CM_NAME'];
  51. $institution = $profile['CI_NAME'];
  52. $department = $profile['RI_NAME'];
  53. $altEmail = $profile['AP_ALT_EMAIL'];
  54. $vege = $profile['AP_FOOD'];
  55. ?>
  56.  
  57. <div>
  58.  
  59. <br>
  60. <form action="update_profile.php" method="post">
  61. <div class="n_error" id="n_error"><p id="error"></p></div>
  62.  
  63.  
  64. <script type="text/javascript">
  65.  
  66. function getUni(val)
  67. {
  68. $.ajax ({
  69. type: "POST",
  70. url: "get_uni.php",
  71. data: 'CM_ID='+val,
  72. success: function(data){
  73. $("#uni-list").html(data);
  74. }
  75.  
  76. });
  77. }
  78.  
  79. </script>
  80.  
  81.  
  82. <table align=center width="100%" class="table-responsive" style="background-color:white;border:transparent;" >
  83. <tr>
  84. <th colspan='3'> Personal Info
  85. </th>
  86. </tr>
  87. <tr>
  88. <td colspan='3'>&nbsp;</td>
  89. </tr>
  90. <tr>
  91. <td>Salutation</td>
  92. <td>:</td>
  93. <td>
  94. <select name="salutation" style="width:155px" class='form-control'>
  95. <?php
  96. while($salutation = mysqli_fetch_array($salutationQuery)){ ?>
  97. <?php echo "<option value='".$salutation['SM_REF']."' "; if($salutation['SM_DESC']== $salutations){ echo "SELECTED "; } echo ">"; echo $salutation['SM_DESC']."</option>}";} ?>
  98. </select>
  99. </td>
  100. </tr>
  101. <tr>
  102. <td>First Name</td>
  103. <td>:</td>
  104. <td><input type=text name="fname" class='form-control' style='width:70%' value="<?php echo $fname ?>" ></td>
  105. </tr>
  106. <!--<tr>
  107. <td>Middle Name</td>
  108. <td>:</td>
  109. <td><input type=text name='mname' class='form-control' style='width:70%' value="<?php echo $mname?>" ></td>
  110. </tr>-->
  111. <tr>
  112. <td>Last Name</td>
  113. <td>:</td>
  114. <td><input type=text name='lname' class='form-control' style='width:70%'value="<?php echo $lname?>" ></td>
  115. </tr>
  116. <tr>
  117. <td>Mailing Address</td>
  118. <td>:</td>
  119. <td><textarea name='address' class='form-control' rows="10" required><?php echo $profile['AP_MAILING_ADDRESS']; ?></textarea></td>
  120. </tr>
  121.  
  122.  
  123. <tr>
  124. <td>Country</td>
  125. <td>:</td>
  126. <td>
  127. <select name="country" id="country-list" style="width:70%" class='form-control' onChange="getUni(this.value);">
  128. <?php
  129. while($countries = mysqli_fetch_array($countryQuery)){ ?>
  130. <?php echo "<option value='".$countries['CM_ID']."' "; if($countries['CM_NAME']== $country){ echo "SELECTED "; } echo ">"; echo $countries['CM_NAME']."</option>}";} ?>
  131. </select>
  132. </td>
  133. </tr>
  134.  
  135.  
  136.  
  137. <tr>
  138. <td>Institution</td>
  139. <td>:</td>
  140. <td>
  141. <select name="institution" style="width:70%" class='form-control'>
  142. <?php
  143. while($r_university = mysqli_fetch_array($institutionQuery)){ ?>
  144. <?php echo "<option value='".$r_university['RU_CM_ID']."' "; if($r_university['RU_NAME']== $institution){ echo "SELECTED "; } echo ">"; echo $r_university['RU_NAME']."</option>}";} ?>
  145. </select>
  146. </td>
  147. </tr>
  148.  
  149.  
  150.  
  151. <tr>
  152. <td>Department</td>
  153. <td>:</td>
  154. <td>
  155. <select name="department" style="width:70%" class='form-control'>
  156. <?php
  157. while($r_industry = mysqli_fetch_array($industryQuery)){ ?>
  158. <?php echo "<option value='".$r_industry['RI_CM_ID']."' "; if($r_industry['RI_NAME']== $department){ echo "SELECTED "; } echo ">"; echo $r_industry['RI_NAME']."</option>}";} ?>
  159. </select>
  160. </td>
  161. </tr>
  162.  
  163.  
  164. <tr>
  165. <td>Phone No.</td>
  166. <td>:</td>
  167. <td><input type=text name="phone" class='form-control' style='width:70%' value="<?php echo $phone ?>"> </td>
  168. </tr>
  169. <tr>
  170. <td>Alternative Email</td>
  171. <td>:</td>
  172. <td><input type="email" name="alt_email" class='form-control' style='width:70%' value="<?php echo $altEmail ?>"> </td>
  173. </tr>
  174. <?php
  175.  
  176. $checked0="";
  177. $checked1="";
  178. if($vege!=1)
  179. $checked0="checked";
  180. else
  181. $checked1="checked";
  182. ?>
  183. <tr>
  184. <td>Vegetrarian</td>
  185. <td>:</td>
  186. <td> <input type="radio" name="food" value=1 <?php echo $checked1; ?>> Yes <input type="radio" name="food" value=0 <?php echo $checked0; ?>> No</td>
  187. </tr>
  188. <tr>
  189. <td colspan='2'></td>
  190. <td><input type=submit value='Update Profile' class='btn btn-sm' name='btn_submit' id='btn_submit' > <input class='btn btn-sm' type=reset value='Reset' ></td>
  191. </tr>
  192. </table>
  193. </form>
  194. </div>
  195.  
  196. </body>
  197.  
  198. <?php
  199. mysqli_close($conn);
  200. require_once 'footer.php';
  201. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement