Forum Moderators: coopster

Message Too Old, No Replies

Add to a HTML document using a php form

add info to a table

         

toyradar

10:26 pm on Aug 2, 2007 (gmt 0)

10+ Year Member



basically, i need to create a form that, when submitted, will add data to the bottom of a table.

the table is at <removed> on the results page.

i can work out how to do the form that submits the data, but i have no idea how to make it edit the actual results document.

cheers!

[edited by: jatar_k at 1:08 am (utc) on Aug. 3, 2007]
[edit reason] no urls thanks [/edit]

oxidetones

12:59 am on Aug 3, 2007 (gmt 0)

10+ Year Member



are you hand coding or using DW?

jatar_k

1:09 am on Aug 3, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld toyradar,

do you want it to edit the actual html file?

toyradar

8:13 am on Aug 3, 2007 (gmt 0)

10+ Year Member



i'm using DW and coda.

i just need to add data to the bottom of the table, but its not for me, its for the owner of the website.

any ideas?

jatar_k

12:11 pm on Aug 3, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



If the site owner doesn't want to use a database, which would be the easiest, then your best bet would be to use an include to include the table but I would probably put the actual table tags in the including file

like so

<table>
<?php include 'tabledata.php';?>
</table>

this way you can just append to the tabledata.php file and not have to worry about writing the closing table tag every time.

then when you want to add data you can use fopen [php.net] to open tabledata.php for append, then write a row to it with the new data using fwrite [php.net] then use fclose [php.net] to close the file.