retriving data and update it back to db

Codes here !

Moderators: macek, egami, gesf

Post Reply
fielding
New php-forum User
New php-forum User
Posts: 8
Joined: Fri Oct 25, 2002 1:16 pm

retriving data and update it back to db

Post by fielding » Fri Oct 25, 2002 3:33 pm

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
</td>
....

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.

john

DutchBen
New php-forum User
New php-forum User
Posts: 36
Joined: Thu Oct 24, 2002 10:28 am
Location: Amsterdam

Post by DutchBen » Sat Oct 26, 2002 4:02 am

what?

fielding
New php-forum User
New php-forum User
Posts: 8
Joined: Fri Oct 25, 2002 1:16 pm

much clear?

Post by fielding » Sat Oct 26, 2002 7:36 am

: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
+--------------I-------------+-----------------I---------------+



DutchBen
New php-forum User
New php-forum User
Posts: 36
Joined: Thu Oct 24, 2002 10:28 am
Location: Amsterdam

Post by DutchBen » Mon Oct 28, 2002 2:42 am

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

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests