473,378 Members | 1,482 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

forms, validation and elegance...

hello,

i have a website to do which will needs many forms, and i'm looking for an
elegant way to handle them...

i would like to know how do you use php and forms , how do you validate user
entries (on the server side, i'm not interested in javascript in this post)
and when needed how do you display error messages for bad or missing
entries.

i was thinking of using directly html and "include" them inside full php
pages, put here my trouble is that i still need to have php code inside what
i would like to be full html, at least for default value or when editing...
i can also think of having a php class to create a form but here it is the
opposite : html code inside php.

so i would like to have your opnion, thoughts on it, and how do you proceed
to separate php code which handle forms and theirs validations from html
used for presentation.

thanks.

ps : if you are not interested in it maybe you could tell how you handle
multilingual site... (by having everything in a database, by having some
kind of translation table, or as many pages as availables languages, or ???)
Jul 17 '05 #1
4 1942
There's probably some pretty good libraries out there for dealing with
forms..
I created a home-brew set of functions / procedures..

basically has 2 parts.

a form definition array where I define every field, whether or not
it's required (can be dependant on other fields), valid format (can be
a reg-exp), default value (if any), a "label", and any other params
that would be found in the input tag..

I define the layout of the form..

then I pass this array to a "handle form" function which prints out
the form.. it highlights any missed or invalid fields, etc..

works on multi-part/page forms, etc.. custom check-box graphics,
etc..
"GrelEns" <gr*****@NOSPAMyahoo.NOTNEEDEDfr> wrote in message news:<40***********************@news.free.fr>...
hello,

i have a website to do which will needs many forms, and i'm looking for an
elegant way to handle them...

i would like to know how do you use php and forms , how do you validate user
entries (on the server side, i'm not interested in javascript in this post)
and when needed how do you display error messages for bad or missing
entries.

i was thinking of using directly html and "include" them inside full php
pages, put here my trouble is that i still need to have php code inside what
i would like to be full html, at least for default value or when editing...
i can also think of having a php class to create a form but here it is the
opposite : html code inside php.

so i would like to have your opnion, thoughts on it, and how do you proceed
to separate php code which handle forms and theirs validations from html
used for presentation.

thanks.

ps : if you are not interested in it maybe you could tell how you handle
multilingual site... (by having everything in a database, by having some
kind of translation table, or as many pages as availables languages, or ???)

Jul 17 '05 #2
Brad Kent wrote:
There's probably some pretty good libraries out there for dealing with
forms..
I created a home-brew set of functions / procedures..

basically has 2 parts.

a form definition array where I define every field, whether or not
it's required (can be dependant on other fields), valid format (can be
a reg-exp), default value (if any), a "label", and any other params
that would be found in the input tag..

I define the layout of the form..

then I pass this array to a "handle form" function which prints out
the form.. it highlights any missed or invalid fields, etc..

works on multi-part/page forms, etc.. custom check-box graphics,
etc..


thanks for the answer,

is this librairy publicly available ?

best,
Jul 17 '05 #3
GrelEns wrote:
Brad Kent wrote:
There's probably some pretty good libraries out there for dealing with
forms..
I created a home-brew set of functions / procedures..

basically has 2 parts.

a form definition array where I define every field, whether or not
it's required (can be dependant on other fields), valid format (can be
a reg-exp), default value (if any), a "label", and any other params
that would be found in the input tag..

I define the layout of the form..

then I pass this array to a "handle form" function which prints out
the form.. it highlights any missed or invalid fields, etc..

works on multi-part/page forms, etc.. custom check-box graphics,
etc..

thanks for the answer,

is this librairy publicly available ?

best,


There's a PEAR class that does a lot of what you're seeking:
http://pear.php.net/package/HTML_QuickForm/

I haven't used it (yet), but it looks handy.

Regards,

- Dan
http://blog.dantripp.com/
Jul 17 '05 #4
cfm
You can look at http://phpformgen.sourceforge.net I just downloaded it, but
haven't used in in production. It looks quite good, though...
"GrelEns" <gr*****@NOSPAMyahoo.NOTNEEDEDfr> wrote in message
news:40***********************@news.free.fr...
hello,

i have a website to do which will needs many forms, and i'm looking for an
elegant way to handle them...

i would like to know how do you use php and forms , how do you validate user entries (on the server side, i'm not interested in javascript in this post) and when needed how do you display error messages for bad or missing
entries.

i was thinking of using directly html and "include" them inside full php
pages, put here my trouble is that i still need to have php code inside what i would like to be full html, at least for default value or when editing... i can also think of having a php class to create a form but here it is the
opposite : html code inside php.

so i would like to have your opnion, thoughts on it, and how do you proceed to separate php code which handle forms and theirs validations from html
used for presentation.

thanks.

ps : if you are not interested in it maybe you could tell how you handle
multilingual site... (by having everything in a database, by having some
kind of translation table, or as many pages as availables languages, or ???)



Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: ALthePal | last post by:
Hi, I'm not sure if we are able to or even how to loop through the web forms in a VB.NET project during design time. In MSAccess we are able to go through the database -> forms collection and...
14
by: Matt | last post by:
I want to know if ASP.NET Web Forms Validation Controls are Server-Side or Client-Side form validation? Since I think each validator control can select either 1) JavaScript based error dialog or 2)...
4
by: | last post by:
Hi Has anyone any experience using client side validation with asp.net forms. Specifically I'd like to know... 1. How do you attach client side code web controls (a button), like a...
8
by: TJS | last post by:
what are folks doing to get around limitation of one server form per page ?
5
by: excelleinc.com | last post by:
Hello, I have 2 forms to be filled by user, one is "auth" and second one contact form. They're completely independent. Problem is that when I enclose them within same <form runat="server"> tag...
3
by: nzanella | last post by:
Hello, I just ran into the restriction of ASP.NET allowing no more than one <form> tag with the runat="server" attribute per page. This seems like a big restriction to me. I ran across the...
3
by: Saket Mundra | last post by:
I have multiple web forms in my application. The user after logging on is directed to form1 where he enters information desired. Once finished he is directed to form2 and the same procedure goes on...
5
by: matt | last post by:
hello, i am on an interesting project. in this project, i have to create dynamic data-entry forms for offline-users to fill out, save locally, and eventually postback to our app (when back...
1
by: Sergei Riaguzov | last post by:
Hi. I haven't written in PHP too much so I think I should ask how my problem can be solved "the right way". I'm having some forms (actually this is not my code, and actually I haven't got it yet...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.