puja Posted April 24, 2006 Share Posted April 24, 2006 hiIve implemented edit details function but how it works is that when i view the records, there is a link to edit that particular record.Now that all works fine but when it shows the edit details form, it is empty, is there a way that i can get it to display the information that the record already has and then they can just edit it accordingly rather than having to input all the information again, even the stuff that is already correct?thanks Quote Link to comment Share on other sites More sharing options...
wisewood Posted April 24, 2006 Share Posted April 24, 2006 As a very rough example...This will display the values of first_name, last_name and address fetched from a database table.When you click submit, it will send the updated information to you_update_script.php, which will then use a mysql UPDATE to set the new values to the appropriate record.If you need further explaination, let me know.<code]<?php// Connect to your database// Get the details of the record that you want to edit?><FORM METHOD="post" ACTION="your_update_script.php"><INPUT TYPE="text" NAME="first_name" VALUE="<?php echo '$first_name'; ?>"><br><INPUT TYPE="text" NAME="last_name" VALUE="<?php echo '$last_name'; ?>"><br><TEXTAREA NAME="address" COLS="35" ROWS="6"><?php echo '$address'; ?><br></FORM>[/code] Quote Link to comment Share on other sites More sharing options...
puja Posted April 24, 2006 Author Share Posted April 24, 2006 hiyathanks, i do understand wot ur saying but my form part looks like: echo '<h2> Edit Customer </h2> <form action = "edit_cust_details.php" method = "post"> <p>User Name: <input type="text" name ="user_name" size="15" maxlength="15" value"' .$row[0] . '"/></p> <p>First Name: <input type="text" name ="first_name" size="15" maxlength="15" value"' .$row[1] . '"/></p> <p>Last Name: <input type="text" name ="last_name" size="15" maxlength="15" value"' .$row[2] . '"/></p> <p>Email: <input type="text" name ="email" size="15" maxlength="15" value"' .$row[3] . '"/></p> <p><input type="submit" name="submit" value="Submit" /></p> <input type="hidden" name="submitted" value="TRUE" /> <input type="hidden" name="user_name" value="' . $id . '" /> </form>';so im not sure how i cud include ur suggestion Quote Link to comment Share on other sites More sharing options...
wisewood Posted April 24, 2006 Share Posted April 24, 2006 looks like you're on the right lines anyway. Your method does the same as mine. Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted April 24, 2006 Share Posted April 24, 2006 Your HTML is not correct. You need an equals sign, "=", after the word "value".[code]<?php echo '<h2> Edit Customer </h2><form action = "edit_cust_details.php" method = "post"><p>User Name: <input type="text" name ="user_name" size="15" maxlength="15" value="' .$row[0] . '"/></p><p>First Name: <input type="text" name ="first_name" size="15" maxlength="15" value="' .$row[1] . '"/></p><p>Last Name: <input type="text" name ="last_name" size="15" maxlength="15" value="' .$row[2] . '"/></p><p>Email: <input type="text" name ="email" size="15" maxlength="15" value="' .$row[3] . '"/></p>?>[/code]Ken Quote Link to comment Share on other sites More sharing options...
puja Posted April 24, 2006 Author Share Posted April 24, 2006 ok thank youi'll put the = in thenand can i get rid of the $row[0] and put in my actual field names instead or wud i need both to try and solve wot i am doing? Quote Link to comment Share on other sites More sharing options...
wisewood Posted April 24, 2006 Share Posted April 24, 2006 [a href=\"http://www.freewebmasterhelp.com/tutorials/phpmysql/5\" target=\"_blank\"]http://www.freewebmasterhelp.com/tutorials/phpmysql/5[/a] Quote Link to comment Share on other sites More sharing options...
puja Posted April 24, 2006 Author Share Posted April 24, 2006 sorry just ignore my last reply, putting that = in after value solved the problem!thanks guys!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.