Dear All,

Here's what I'm interested in doing but can't get working.

In my webpage, the user can visualize some information
from the database and eventually choose to edit it. (All
this is done with AJAX). When the user clicks on "edit" the
appropriate <DIV> section is refreshed such that the aforementioned
information appears in a text input and can now be modified
by the user.

What I would like to do next, is to take this modified information,
associate it with a new variable and send it to the database to
replace the old information - this is done after clicking a "save" button.
(Again done with AJAX). However I'm having difficulties with this as
I do not know how to associate the new information from the text
input to a new variable. Perhaps there is a more intelligent way?

Any ideas are welcome!

Best from Brussels,

TMT000

Please post your code so we may have look at it

> What I would like to do next, is to take this modified information,
> associate it with a new variable and send it to the database to
> replace the old information - this is done after clicking a "save" button.
> (Again done with AJAX). However I'm having difficulties with this as
> I do not know how to associate the new information from the text
> input to a new variable. Perhaps there is a more intelligent way?

You would definitely need some method of identifying which row of your database be updated. If you are allowing your users to edit the content they posted, sending the user information along with the post id (a value which uniquely identifies your post) would do the job though you would need to do some security checks at the server side concerning whether the user editing the post is really the one who is logged in.

Once you have the required meta information, all you would require to do is to read the data from the text area and send it using Ajax.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.