very basic question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

rleslie1970
Forum Newbie
Posts: 6
Joined: Thu Aug 16, 2007 5:45 pm

Post by rleslie1970 »

actually the code that i posted was the section before validating your form. she does have a section on that; however, she makes it kind of confusing.

Up until now, she has you build two files - one an html file and the other a php file that does the scripting. In the section on form validation however, she has you build one file - a php file and create your entire form as a variable and add a bunch of if and else statements that send up red comments if data isn't entered. Is that normal to build only one file? or can you do form validation when you have two files? Maybe not...since the original file is html and you need to do the form validation in php......
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

Typically, we suggest that it all be done in one file, but technically, when you separate form from function, it can span across multiple files. I'm not exactly sure what the example you are referring to works like, as the mixture of a static HTML file and a processing PHP file isn't something I've tried in that sense.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

There are lots of ways to accomplish what the author is suggesting. I just wish the author would have thought to suggest validation before anything you implement. But its all good, as long as what you are learning in the book never makes it off of your local server, you should be safe.
Post Reply