Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //require_once 'header.php';
- require_once 'dbConnect.php';
- session_start();
- $salutationQuery = mysqli_query($conn,"SELECT * FROM salutation_main");
- $genderQuery = mysqli_query($conn,"SELECT * FROM gender_main");
- $countryQuery = mysqli_query($conn,"SELECT * FROM countries ORDER BY CM_NAME ASC");
- $institutionQuery = mysqli_query($conn,"SELECT * FROM r_university ORDER BY RU_NAME ASC");
- $industryQuery = mysqli_query($conn,"SELECT * FROM r_industry ORDER BY RI_NAME ASC");
- $userID = $_SESSION['userID'];
- // $getProfileQuery = "SELECT
- // a.AP_USER_ID,
- // a.AP_FIRST_NAME,
- // a.AP_LAST_NAME,
- // a.AP_AFFILIATION,
- // a.AP_PHONE_NO,
- // a.AP_MAILING_ADDRESS,
- // a.AP_COUNTRY,
- // c.SM_DESC,
- // d.UL_EMAIL_ADDRESS,
- // e.CM_NAME
- // FROM
- // applicant_profile AS a ,
- // salutation_main AS c ,
- // user_login AS d,
- // countries AS e
- // WHERE
- // a.AP_SALUTATION = c.SM_REF AND
- // d.UL_USER_ID = a.AP_USER_ID AND
- // e.CM_ID = a.AP_COUNTRY AND
- // a.AP_USER_ID = '$userID'";
- $getProfileQuery="select * from name_salutation where UL_USER_ID=".$userID." limit 1";
- $getProfile_res = mysqli_query($conn,$getProfileQuery);
- $profile=mysqli_fetch_array($getProfile_res);
- //var_dump($profile);die;
- $salutations = $profile['SM_DESC'];
- $fname = $profile['AP_FIRST_NAME'];
- //$mname = $profile['AP_MIDDLE_NAME'];
- $lname = $profile['AP_LAST_NAME'];
- //$initial = $profile['AP_INITIALS'];
- $affiliation = $profile['AP_AFFILIATION'];
- $email = $profile['UL_EMAIL_ADDRESS'];
- //$address = $profile['AP_MAILING_ADDRESS'];
- $phone = $profile['AP_PHONE_NO'];
- //$fax = $profile['AP_FAX_NO'];
- $country = $profile['CM_NAME'];
- $institution = $profile['CI_NAME'];
- $department = $profile['RI_NAME'];
- $altEmail = $profile['AP_ALT_EMAIL'];
- $vege = $profile['AP_FOOD'];
- ?>
- <div>
- <br>
- <form action="update_profile.php" method="post">
- <div class="n_error" id="n_error"><p id="error"></p></div>
- <script type="text/javascript">
- function getUni(val)
- {
- $.ajax ({
- type: "POST",
- url: "get_uni.php",
- data: 'CM_ID='+val,
- success: function(data){
- $("#uni-list").html(data);
- }
- });
- }
- </script>
- <table align=center width="100%" class="table-responsive" style="background-color:white;border:transparent;" >
- <tr>
- <th colspan='3'> Personal Info
- </th>
- </tr>
- <tr>
- <td colspan='3'> </td>
- </tr>
- <tr>
- <td>Salutation</td>
- <td>:</td>
- <td>
- <select name="salutation" style="width:155px" class='form-control'>
- <?php
- while($salutation = mysqli_fetch_array($salutationQuery)){ ?>
- <?php echo "<option value='".$salutation['SM_REF']."' "; if($salutation['SM_DESC']== $salutations){ echo "SELECTED "; } echo ">"; echo $salutation['SM_DESC']."</option>}";} ?>
- </select>
- </td>
- </tr>
- <tr>
- <td>First Name</td>
- <td>:</td>
- <td><input type=text name="fname" class='form-control' style='width:70%' value="<?php echo $fname ?>" ></td>
- </tr>
- <!--<tr>
- <td>Middle Name</td>
- <td>:</td>
- <td><input type=text name='mname' class='form-control' style='width:70%' value="<?php echo $mname?>" ></td>
- </tr>-->
- <tr>
- <td>Last Name</td>
- <td>:</td>
- <td><input type=text name='lname' class='form-control' style='width:70%'value="<?php echo $lname?>" ></td>
- </tr>
- <tr>
- <td>Mailing Address</td>
- <td>:</td>
- <td><textarea name='address' class='form-control' rows="10" required><?php echo $profile['AP_MAILING_ADDRESS']; ?></textarea></td>
- </tr>
- <tr>
- <td>Country</td>
- <td>:</td>
- <td>
- <select name="country" id="country-list" style="width:70%" class='form-control' onChange="getUni(this.value);">
- <?php
- while($countries = mysqli_fetch_array($countryQuery)){ ?>
- <?php echo "<option value='".$countries['CM_ID']."' "; if($countries['CM_NAME']== $country){ echo "SELECTED "; } echo ">"; echo $countries['CM_NAME']."</option>}";} ?>
- </select>
- </td>
- </tr>
- <tr>
- <td>Institution</td>
- <td>:</td>
- <td>
- <select name="institution" style="width:70%" class='form-control'>
- <?php
- while($r_university = mysqli_fetch_array($institutionQuery)){ ?>
- <?php echo "<option value='".$r_university['RU_CM_ID']."' "; if($r_university['RU_NAME']== $institution){ echo "SELECTED "; } echo ">"; echo $r_university['RU_NAME']."</option>}";} ?>
- </select>
- </td>
- </tr>
- <tr>
- <td>Department</td>
- <td>:</td>
- <td>
- <select name="department" style="width:70%" class='form-control'>
- <?php
- while($r_industry = mysqli_fetch_array($industryQuery)){ ?>
- <?php echo "<option value='".$r_industry['RI_CM_ID']."' "; if($r_industry['RI_NAME']== $department){ echo "SELECTED "; } echo ">"; echo $r_industry['RI_NAME']."</option>}";} ?>
- </select>
- </td>
- </tr>
- <tr>
- <td>Phone No.</td>
- <td>:</td>
- <td><input type=text name="phone" class='form-control' style='width:70%' value="<?php echo $phone ?>"> </td>
- </tr>
- <tr>
- <td>Alternative Email</td>
- <td>:</td>
- <td><input type="email" name="alt_email" class='form-control' style='width:70%' value="<?php echo $altEmail ?>"> </td>
- </tr>
- <?php
- $checked0="";
- $checked1="";
- if($vege!=1)
- $checked0="checked";
- else
- $checked1="checked";
- ?>
- <tr>
- <td>Vegetrarian</td>
- <td>:</td>
- <td> <input type="radio" name="food" value=1 <?php echo $checked1; ?>> Yes <input type="radio" name="food" value=0 <?php echo $checked0; ?>> No</td>
- </tr>
- <tr>
- <td colspan='2'></td>
- <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>
- </tr>
- </table>
- </form>
- </div>
- </body>
- <?php
- mysqli_close($conn);
- require_once 'footer.php';
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement