Click to See Complete Forum and Search --> : need help with php [editing data from database]


stanleyns
10-20-2005, 01:12 AM
hi guys, i need help with editing data from my database using php...
actually in my webpage, i've divided it into 2 part on the left is my form and on the right is my datagrid (where i list the data in my database)..
and what i wanted to do is :

from my list of data in the right section, i wanted to be able to click them and the data from the database will appear in the forms fields on the left.. so if its data containing :
firstname: john, lastname: doe, address: 123 wicker park, email:john@doe.com

i want those data to be inserted to the forms on the left and will occupy its own fields on the form..

please help me guys and if u guys are not that sure about my question please ask more detailed question to me.. or at least give me an idea on how i would be able to do that.. with javascript? or is it enough using php?
thx guys..

ava
10-20-2005, 03:34 AM
No, you need a client-based language like Javascript for that. The function is not too hard though.

Just set on OnClick event on the cells you want to click on and create a function that does the following:
- Take the variables from the fields that you need
- Place those variables in the fields where you want them

I can't be more precise without details. Maybe you could post a link to the page if it's already online.

ava
10-20-2005, 04:08 AM
sorry, double post

NogDog
10-20-2005, 08:41 AM
It could be done with PHP instead of client-side. The disadvantage is that the page would have to reload when you selected the data item on the right side to be populated into the form. The advantage is that you do not depend on the user's browser having the necessary client-side technology being available and enabled.

Basically, each row of data on the right side would be a HTML form, using hidden fields or disabled fields for each of the data elements. Each row/form would have a submit button. When submitted, your page would then populate the corresponding form fields on the left from the $_POST array.

stanleyns
10-20-2005, 09:39 AM
okay guys.. thanks for the tips.. i'd consider both ways and see which one i can use for my project.. :)