graham23s Posted March 31, 2007 Share Posted March 31, 2007 Hi Guys, i have made a login script which is working good, once the user login in successfully they can edit there details: <p align="left">Welcome, <b><font color="red"><? echo $_COOKIE['member'] ?></font></b>! (<a href="logout.php">Logout</a>) - [ <a href="change_password.php">Change Password Or E-mail Address</a> ] - [ <a href="edit_profile.php">Edit Profile</a> ] - [ <a href="upload_photo.php">Upload Photo</a> ]</p> <?php // Start retrieving user profile from database////////////////////////////////////// $qProfile = "select * from membership where username='$member'"; $rsProfile = mysql_query($qProfile); $row = mysql_fetch_array($rsProfile); // get the resultset into an array///////////// extract($row); // extract the resultset // Now print the form, in HTML format with php thrown in///////////////////////////// ?> <p>Edit Your Profile Details<p> <p><form action="edit_profile_done.php" method="post"> <table width="400" border="0" bordercolor="black" cellspacing="2" cellpadding="2"> <tr> <td align="right" bgcolor="#E2E2E2">Your E-Mail<td> <td bgcolor="#E2E2E2"><input name="email" type="text" id="name" maxlength="30" size="25" value="<?php echo "$email"; ?>"></td> </tr> <tr> <td align="right" bgcolor="#E2E2E2">Your Occupation:</td> <td bgcolor="#E2E2E2"><input name="occupation" type="text" id="name" maxlength="30" size="25" value="<?php echo "$occupation"; ?>"></td> </tr> <tr> <td align="right" bgcolor="#E2E2E2">Your Description:</td> <td bgcolor="#E2E2E2"><textarea name="description" rows="20" cols="25"><?php echo "$description"; ?></textarea></td> </tr> <tr> <td align="right" bgcolor="#E2E2E2">Your Countrytd> <td bgcolor="#E2E2E2"><textarea name="country" rows="20" cols="25"><?php echo "$country"; ?></textarea></td> </tr> <tr> <td bgcolor="#E2E2E2"> </td><input type="hidden" name="username" value="<?php echo "$username"; ?>" > <td bgcolor="#E2E2E2"><input type="submit" name="Submit" value="Update Profile!"></td> </table> ^ Above displays the form outputting the users details in the text areas, but i am having trouble entering new details and saving them, i can do the first line (email) ok, it stores that fine, but doesn't store the other 3 sections. <?php // Start of Update Code // For register_global on PHP settings $username = mysql_escape_string($_POST['username']); $email = mysql_escape_string($_POST['email']); $occupation = mysql_escape_string($_POST['occupation']); $description = mysql_escape_string($_POST['description']); $country = mysql_escape_string($_POST['country']); // Update Database put the variables in a query $query = "UPDATE membership SET email='$email' "; $query .= " WHERE username='$username' "; $result = mysql_query($query); if ($result) { echo "<p>Thank you. Your profile has been updated.</p>"; } ?> any help would be appreciated cheers Graham Link to comment https://forums.phpfreaks.com/topic/45087-updating-users-profile-details/ Share on other sites More sharing options...
AndyB Posted March 31, 2007 Share Posted March 31, 2007 ... but doesn't store the other 3 sections. because the UPDATE query doesn't attempt to update those fields. Link to comment https://forums.phpfreaks.com/topic/45087-updating-users-profile-details/#findComment-218866 Share on other sites More sharing options...
graham23s Posted April 1, 2007 Author Share Posted April 1, 2007 Hi Mmate, i deliberately only did 1 field because that's the only one that updates successfully, the minute i add 2,3 or the 4th one together it doesn't seem to work. Graham Link to comment https://forums.phpfreaks.com/topic/45087-updating-users-profile-details/#findComment-219039 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.