Hi
I have an 'edit_profile' form.
I'm having several issues with this form . There are some fields which are working fine and some aren't.
This 1st issue is regarding the textarea fields
When the user updates their profile, any field, the textarea adds characters which are
bye<br /><br /><br />\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\r\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\nbye<br /><br /><br />\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\r\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
This is the output field:
<textarea name="reg_info" cols="45" rows="5" class="roundedfield" id="reg_info"><?php if (!empty($reg_info)) echo nl2br(htmlspecialchars($reg_info, ENT_NOQUOTES, 'UTF-8')); ?></textarea>
I'm using a parameterised query to insert to the datbase:
// $stmnt1 = $db->stmt_init();
if ($stmnt1 = $dbc -> prepare("UPDATE tutor_reg SET ID=?,reg_name=?, reg_NRIC=?, reg_add_1=?,reg_add_2=?,reg_postcode=?, reg_contact_h=?, reg_contact_m=?, reg_email=?,reg_gender=?, reg_dob=?, reg_situation=?, reg_ethnic=?, reg_other=?, reg_nationality=?, screenpath=?, reg_image=?, pdfpath=?, pdf_main=?, reg_occupy=?, reg_edulevel=?, reg_institute=?, reg_course=?, reg_year=?, reg_qual=?, reg_achieve=?, reg_info=?, reg_exp=?, reg_level1=?, reg_level2=?, reg_level3=?, reg_sub1=?, reg_sub2=?, reg_sub3=?, reg_area=?, reg_rate=?, username=?, secQ=?,secA=?,reg_howhear=? WHERE ID=?")) {
$stmnt1->bind_param("isssssiisssssssssssssssisssisssssssisissi", $ID, $reg_name, $reg_NRIC, $reg_add_1, $reg_add_2, $reg_postcode, $reg_contact_h, $reg_contact_m, $reg_email, $reg_gender, $reg_dob, $reg_situation, $reg_ethnic, $reg_other, $reg_nationality, $screenpath, $reg_image_name, $pdfpath, $pdf_main_name, $reg_occupy, $reg_edulevel, $reg_institute, $reg_course, $reg_year, $reg_qual, $reg_achieve, $reg_info, $reg_exp, $reg_level1, $reg_level2, $reg_level3, $reg_sub1, $reg_sub2, $reg_sub3, $reg_area, $reg_rate, $username, $secQ, $secA, $reg_howhear,$ID);
$stmnt1->execute();
$stmnt1->close();
Issue with Contact Number Fields
My second issue is regarding the contact fields: reg_contact_h & reg_contact_m
The are set as int in the database.
When the user edit their profile and submits the form, the original contact numbers are removed from the database.
If a user edits a contact number, it is also not uploaded to the database.
The issue must lie in the query, but I just can't see where it is.
The code is quite long with a pile of jquery client-side and php server side validation going on (some of which is working and some isn't which is also strange)....I can't work out where all the problems are.
<label for="rqst_contact_h"></label>
<input type="text" name="rqst_contact_h" class="roundedfield" id="rqst_contact_h" value="<?php if (!empty($reg_contact_h)) echo htmlspecialchars($reg_contact_h, ENT_NOQUOTES, 'UTF-8'); ?>" size="20">
<label for="rqst_contact_m"></label>
<input type="text" name="rqst_contact_m" class="roundedfield" id="rqst_contact_m" value="<?php if (!empty($reg_contact_m)) echo htmlspecialchars($reg_contact_m, ENT_NOQUOTES, 'UTF-8'); ?>" size="20">