Page 1 of 1

retriving data and update it back to db

Posted: Fri Oct 25, 2002 3:33 pm
by fielding
hi, i am thinking of using one table ceil to accept data retrived from database, after update of the data and then send them back to db.
like this:
<td width="40%"> Student name:</td>
<td width="40%"> <?php echo $name ?> ///---to accept the data
//retrived from db

<input type="text" name="stanme"> //--to accept input
//(modify) the value
//of $name then update
//it to db

I doubt that one ceil is used to accept retrived data and assigned to accept input will not work, but I don't know how to realize this function.
Does somebody know?

thnk u for your reply.


Posted: Sat Oct 26, 2002 4:02 am
by DutchBen

much clear?

Posted: Sat Oct 26, 2002 7:36 am
by fielding
:oops: I think I didn't explanation my question clear, my questionis I want to retrive a set of data (say, personal information) and display them in a table format. then I want to update of the data in the table(say my phone No. my address...) then update.
I use <?php echo $variablename ?> to display the retrived data in the table field specified. but this table field doesn't accept data input, right?
so my question is how can I make this table field (I mean the table ceil on the web page, not the table in the database) to display and accept data input at the same time.
example: below is a set of data retrived from db through mysql, and they are displayed in one row table,
I use <?php echo $item ?> to display John and 123456 in the two table ceils.
now I want to change the phone no to 234567 and update it back in the database file. How can I define the attribute of the ceil displaying the phone No. so that it accepts input! or Should I use some other way to do that?

Code: Select all

I   name:      I   John      I   Phone No.:   I     123456    I

Posted: Mon Oct 28, 2002 2:42 am
by DutchBen
Aah ok.....

Well, the way to do that would be to use an HTML form. A very common thing to do is to have this form call itself.
You output your data into the formfields to display them. -- You can do pretty fancy stuff to the layout of forms using style sheets nowadays --
Than after adjusting the values in the formfields and submitting the form, the form calls itself.
You can have your script check the exsistence of a submit variable and have it update your database if such a variable exists.
Than .. after updating it will show the standard form again.

Hope this helps, and hope its what you where trying to achiev