在过去的两周里,我搜索了 1500 多个帖子,但没有找到让我的代码正常工作的解决方案。我的注册和登录表单工作正常,但是当用户登录以添加或编辑信息时,sql 数据库不会随着用户输入而更新,并且错误/更新的消息不会回显。我的用户使用姓名、姓氏、电子邮件和密码进行注册,但是一旦他们登录,他们需要添加到他们的个人信息中,然后才能编辑个人信息。但是我尝试过的任何方法都没有奏效...请帮助我,我真的需要正确解决这个问题....我的代码如下:
PHP CODE:
<?php
include_once "connect_to_mysql.php";
$id = $_SESSION['id'];
$title=$_POST['title'];
$username=$_POST['username'];
$surname=$_POST['surname'];
$identityno=$_POST['identityno'];
$gender=$_POST['gender'];
$birthdate = strftime("%d %b %Y", strtotime($row['birthdate']));
$ethnicity=$_POST['ethnicity'];
$nationality=$_POST['nationality'];
$homeaddress=$_POST['homeaddress'];
$province=$_POST['province'];
$suburb=$_POST['suburb'];
$hometele=$_POST['hometele'];
$celltele=$_POST['celltele'];
$creditclear=$_POST['creditclear'];
$criminalrecord=$_POST['criminalrecord'];
$driverslicense=$_POST['driverslicense'];
$owntransport=$_POST['owntransport'];
$medicalconditions=$_POST['medicalconditions'];
$query("UPDATE cic_candidates SET title='$title', username='$username', surname='$surname',
identityno='$identityno', gender='$gender', birthdate='$birthdate', ethnicity='$ethnicity',
nationality='$nationality', homeaddress='$homeaddress', province='$province', suburb='$suburb',
hometele='$hometele', celltele='$celltele', creditclear='$creditclear',
criminalrecord='$criminalrecord', driverslicense='$driverslicense',
owntransport='$owntransport', medicalconditions='$medicalconditions' WHERE id='$id'");
mysql_query($query);
echo 'Your account info has been updated, you will now see the new info.<br /><br />
To return to your profile edit area, <a href="edit_personal_details.php">click here</a>';
exit();
mysql_close();
?>