Forum Moderators: open
Beginner here!
I have a database with names, addresses, etc and I want to have a page where when I click one of the names of the people in the list, their details from the database fill a form on that page, which can be editted and then the database is submitted.
How do I gets those details into the form and then how do I submit then back to database?
Thanks,
Sarah
Tons of good info
Scroll down you will find
"The basic of extracting data... PHP MySQL"
I can easily add and remove users from the database. The problem is when modifying:
I'd like to insert the user name into a field and have the other fields (let's say, name, surname, e-mail) completed with the data extracted from the SQL table. Then, after modifying (or not), submit the whole bunch of data and run the UPDATE string to the SQL.
[[I don't know how to turn the data extracted from the SQL into a value for each input of the form. I have both text fields and boxes.]]
Besides, I'd like to make it work without impliying too much webpages (have all integrated into one if possible, even if I need several ".php")
Could anyone give a hand with this? I saw several excellent tutorials and already learnt a lot from you, so any help will be appreciate!
Thanks in advance, see you around. And excuse my english, it's not mi native tongue.
It would be something along these lines:
//connect to db, select database
$query = "SELECT col1,col2 FROM table WHERE userid = 'something'";
$result = [url=http://us2.php.net/manual/en/function.mysql-query.php]mysql_query[/url]($query) or [url=http://us2.php.net/manual/en/function.die.php]die[/url]([url=http://us2.php.net/manual/en/function.mysql-error.php]mysql_error[/url]());
$row = [url=http://us2.php.net/manual/en/function.mysql-fetch-array.php]mysql_fetch_array[/url]($result);
echo '<input type="text" name="col1" value="'.$row['col1'].'" />';
echo '<textarea name="col2">'.$row['col2'].'</textarea>';
I think this explains it well enough :)
Also, if you want to continue learning about this process, can you please keep it in the PHP Forum [webmasterworld.com] as that is where this belongs. ;)
Microsoft first implemented the XMLHttpRequest object in Internet Explorer 5 for Windows as an ActiveX object. Engineers on the Mozilla project implemented a compatible native version for Mozilla 1.0 (and Netscape 7). Apple has done the same starting with Safari 1.2.
Oh, and:
Also, if you want to continue learning about this process, can you please keep it in the PHP Forum as that is where this belongs. ;)
Good luck!
P.S. Your English is perfect! Stop worrying about it! :)