Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

having trouble updating data on submit

7:10 am on Aug 16, 2013 (gmt 0)

i am having a little difficulty in displaying my id info on my update page. i have two entries 6 and 7 if i click update on id 6 , it will show on my update page, but when i click on submit, it wont update and also if i click update on id 7, on the address bar, it will indicate that the id =7 but it will still show id 6 infos.

here is my display code that display data on my update page

include ('config.php');
// Retrieve data from database
$sql="SELECT * FROM $tbl_name ";

secondly if i change data on my update page and click on submit the change wont reflect on my view page. and the delete function i dont even know where to start from.

//This is the directory where images will be saved
// update data in mysql database
$sql="UPDATE $tbl_name SET firstname='$firstname', lastname='$lastname', address='$address', nationality='$nationality',accountnumber='$account',accounttype='$accounttype',balance='$balance',username='$username',password='$password'
WHERE id='$id'";

header ("Location: details.php");

9:58 pm on Aug 20, 2013 (gmt 0)

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

Welcome to WebmasterWorld, victorontop.

Make sure that your $_POST indexes match the form field names in your HTML. Also, you should never trust user-supplied input like that in your queries, it is a huge security issue. You need to at the very minimum escape that user-supplied data using mysql_real_escape_string() or some other method of scrubbing the input.

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month