Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.21 KB | None | 0 0
  1. <?php include("vh.php"); ?>
  2. <script type="text/javascript">
  3. $(document).ready(function() {
  4. var birthdate = $("#birthdate").val();
  5. var sex = $("#sex :selected").val();
  6. var interestedIn = $("#interestedIn :selected").val();
  7. var relationshipStatus = $("#relationshipStatus :selected").val();
  8. var knownLanguages = $("#knownLanguages").val();
  9. var religiousViews = $("#religiousViews").val();
  10. var politicalViews = $("#politicalViews").val();
  11. var aboutMe = $("#aboutMe").val();
  12. var mobilePhone = $("#mobilePhone").val();
  13. var neighborhood = $("#neighborhood").val();
  14. var website = $("#website").val();
  15. var email = $("#email").val();
  16.  
  17. $("#submitForm").live('click', function() {
  18. updateUserInfo();
  19. });
  20.  
  21. function updateUserInfo() {
  22. jQuery.ajax({
  23. type: "POST",
  24. dataType: "JSON",
  25. url: "<?=base_url()?>index.php/regUserDash/updateUserInfo",
  26. data: { birthdate: birthdate,
  27. sex: sex,
  28. interestedIn: interestedIn,
  29. relationshipStatus: relationshipStatus,
  30. knownLanguages: knownLanguages,
  31. religiousViews: religiousViews,
  32. politicalViews: politicalViews,
  33. aboutMe: aboutMe,
  34. mobilePhone: mobilePhone,
  35. neighborhood: neighborhood,
  36. website: website,
  37. email: email
  38. }, success: function(data) {
  39. if(data.userInfoUpdated == true) {
  40. alert("hello");
  41. }
  42. }
  43. });
  44. }
  45. });
  46. </script>
  47. <?php $selectedId = $_REQUEST['id'];
  48. $myuserid = $this->session->userdata('userid'); ?>
  49. <table style="width: 34%">
  50. <tr>
  51. <td style="width: 193px"><span class="font1">Birthdate</span></td>
  52. <td style="width: 275px">
  53. <input id="birthdate" class="textbox1" style="width: 200pt" type="text" /></td>
  54. </tr>
  55. <tr>
  56. <td style="width: 193px"><span class="font1">Sex</span></td>
  57. <td style="width: 275px">
  58. <select class="textbox1" id="sex" style="width: 207pt">
  59. <option selected="selected">Select your sex</option>
  60. <option>Male</option>
  61. <option>Female</option>
  62. </select></td>
  63. </tr>
  64. <tr>
  65. <td style="width: 193px" class="font1">Interested In</td>
  66. <td style="width: 275px">
  67. <select class="textbox1" id="interestedIn" style="width: 207pt">
  68. <option selected="selected">Select your interest</option>
  69. <option>Men</option>
  70. <option>Women</option>
  71. </select></td>
  72. </tr>
  73. <tr>
  74. <td style="width: 193px" class="font1">Relationship Status</td>
  75. <td style="width: 275px">
  76. <select class="textbox1" id="relationshipStatus" style="width: 207pt">
  77. <option selected="selected">Select your relationship status</option>
  78. <option>Single</option>
  79. <option>In a relationship</option>
  80. <option>Engaged</option>
  81. <option>Married</option>
  82. <option>It's complicated</option>
  83. <option>In an open relationship</option>
  84. <option>Widowed</option>
  85. <option>Seperated</option>
  86. <option>Divorsed</option>
  87. <option>In a civil union</option>
  88. <option>In a domestic partnership</option>
  89. </select></td>
  90. </tr>
  91. <tr>
  92. <td style="width: 193px" class="font1">Known Languages</td>
  93. <td style="width: 275px">
  94. <input class="textbox1" id="knownLanguages" style="width: 200pt" type="text" /></td>
  95. </tr>
  96. <tr>
  97. <td style="width: 193px" class="font1">Religious Views</td>
  98. <td style="width: 275px">
  99. <input class="textbox1" id="religiousViews" style="width: 200pt" type="text" /></td>
  100. </tr>
  101. <tr>
  102. <td style="width: 193px" class="font1">Political Views</td>
  103. <td style="width: 275px">
  104. <input class="textbox1" id="politicalViews" style="width: 200pt" type="text" /></td>
  105. </tr>
  106. <tr>
  107. <td style="width: 193px" class="font1">About Me<br />
  108. <br />
  109. <br />
  110. <br />
  111. </td>
  112. <td style="width: 275px">
  113. <textarea class="textarea2" id="aboutMe" style="width: 198pt; height: 93px"></textarea></td>
  114. </tr>
  115. <tr>
  116. <td style="width: 193px" class="font1">Mobile Phone</td>
  117. <td style="width: 275px">
  118. <input class="textbox1" id="mobilePhone" style="width: 200pt" type="text" /></td>
  119. </tr>
  120. <tr>
  121. <td style="width: 193px" class="font1">Neighborhood</td>
  122. <td style="width: 275px">
  123. <input class="textbox1" id="neighborhood" style="width: 200pt" type="text" /></td>
  124. </tr>
  125. <tr>
  126. <td style="width: 193px" class="font1">Website</td>
  127. <td style="width: 275px">
  128. <input class="textbox1" id="website" style="width: 200pt" type="text" /></td>
  129. </tr>
  130. <tr>
  131. <td style="width: 193px" class="font1">Email</td>
  132. <td style="width: 275px">
  133. <input class="textbox1" id="email" style="width: 200pt" type="text" /></td>
  134. </tr>
  135. <tr>
  136. <td style="width: 193px" class="font1">&nbsp;</td>
  137. <td style="width: 275px; text-align: right">
  138. <input id="submitForm" type="button" value="Submit" style="width: 63px; height: 28px" class="button1"></td>
  139. </tr>
  140. </table>
  141.  
  142. public function updateUserInfo() {
  143. $userid = $this->session->userdata('userid');
  144. $birthdate = $this->input->post("birthdate");
  145. $sex = $this->input->post("sex");
  146. $interestedIn = $this->input->post("interestedIn");
  147. $relationshipStatus = $this->input->post("relationshipStatus");
  148. $languages = $this->input->post("languages");
  149. $religiousViews = $this->input->post("religiousViews");
  150. $politicalViews = $this->input->post("politicalViews");
  151. $aboutMe = $this->input->post("aboutMe");
  152. $mobilePhone = $this->input->post("mobilePhone");
  153. $neighborhood = $this->input->post("neighborhood");
  154. $websites = $this->input->post("websites");
  155. $email = $this->input->post("email");
  156.  
  157. $this->db->query("INSERT INTO user_info (birthdate, sex, interestedIn, relationshipStatus, Languages, religiousViews, politicalViews, aboutMe, mobilePhone, neighborhood, websites, email, userid)
  158. VALUES('{$birthdate}', '{$sex}', '{$interestedIn}', '{$relationshipStatus}', '{$languages}', '{$religiousViews}', '{$politicalViews}', '{$aboutMe}', '{$mobilePhone}', '{$neighborhood}', '{$websites}', '{$email}', '{$userid}')");
  159.  
  160. echo json_encode(array('userInfoUpdated' => true));
  161. }
  162.  
  163. var birthdate = $("#birthdate").val();
  164. var sex = $("#sex :selected").val();
  165. ...
  166.  
  167. data: {
  168. birthdate: $("#birthdate").val(),
  169. sex: $("#sex").val(),
  170. ...
  171. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement