PDA

View Full Version : PHP Form to a webpage


losse
04-12-2006, 01:51 AM
Hi there
I was wondering if it would be possible to set up a submission form with the following parameters:

name, email, phone number

and instead of storing the information to a database, the information is posted on a webpage or sorts?

Is that possible or does it have to touch a database first?

khendar
04-12-2006, 02:01 AM
You could write the data to a flat file. Then read the file back into the webpage.

losse
04-12-2006, 02:24 AM
ooh! that sounds like a plan... Do you think that would be easier than researching how to store it through MySQL?

So the page that "reads" it back would change everytime a new entry would be made in the submission form right?

khendar
04-12-2006, 02:42 AM
Thats right. Roughly both methods would take the same amount of coding, however the database method requires more set up. You'll have to make sure mysql is installed on your server, create a database, create a user, create the tables etc. Whereas the other method just requires you to write the code to do it. For simple applications a flat file is fine. But when you start getting hundreds of records its better to go for a db.

degsy
04-12-2006, 02:04 PM
I would recommend that you start using the database. You will probably find it easier in the future.
http://www.zend.com/php/beginners/php101-8.php

losse
04-12-2006, 03:17 PM
Thanks for the info guys... I think I should bite the bullet and spend the extra effort on the DB method... I am sure it will pay dividends in the future.

All the best!

khendar
04-12-2006, 03:30 PM
I agree - a DB will give you more options later on as well

losse
04-12-2006, 04:52 PM
By the way, say all this is developed and then I'm able to go to a page to view all the entries... Is there a php function that would allow me to put a button on that page and download to CSV in CSV format?

Thanks!

degsy
04-13-2006, 03:14 PM
Depending on what you want or have available then I would recommend installing phpMyAdmin to your webspace. You can manage your database using that.

losse
04-13-2006, 03:57 PM
The reason why I wanted this button was so that I can allow a client to export all the data into a CSV instead of me doing it from PHP MyAdmin...