Hello, i am a bit confused, where is the best place to write the code of a form? in the same file where the forum it self is located or in a other php file?
what structure to use? how do u guys organized you site files? can someone please tell me what is the best way to organize your files in folders? but a other way besides MVC, the problem is that i don`t use frameworks yet, i am still learning php.
php form code and file structure
Moderator: General Moderators
- social_experiment
- DevNet Master
- Posts: 2793
- Joined: Sun Feb 15, 2009 11:08 am
- Location: .za
Re: php form code and file structure
Are you familiar with classes? Personally i keep files that do different things separate. How do you plan to create the form - procedural code or by directly echoing html fragments via php (i.e echo '<form action="" method="" >';)ZetCoby wrote:i am still learning php
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Re: php form code and file structure
yes i am familiar with classes.
well forms i create them directly in html and after i send the info in a other php file to process it but i don`t know if this is the best method to do.
Is it better to create forms in php in echo?
well forms i create them directly in html and after i send the info in a other php file to process it but i don`t know if this is the best method to do.
Is it better to create forms in php in echo?
- social_experiment
- DevNet Master
- Posts: 2793
- Joined: Sun Feb 15, 2009 11:08 am
- Location: .za
Re: php form code and file structure
If the forms are static then the current method you are using is good, stick with it for now 
There are developers who advocate using php to generate html while others advise against it; imo it is good to evaluate what is required of the situation and proceed according to that.
Below are two urls that shows the different approaches.
http://davidwalsh.name/create-html-elem ... ment-class
Shows how you can use php to create html
http://www.php-beginners.com/embedding-php-in-html.html
Shows how you can embed php in an html document
Hth
There are developers who advocate using php to generate html while others advise against it; imo it is good to evaluate what is required of the situation and proceed according to that.
Below are two urls that shows the different approaches.
http://davidwalsh.name/create-html-elem ... ment-class
Shows how you can use php to create html
http://www.php-beginners.com/embedding-php-in-html.html
Shows how you can embed php in an html document
Hth
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering