473,605 Members | 2,703 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

framework for creating forms, phplib good, are there any options?

I have been using phplib for a while and I really like the framework
except for form creation. Maybe it is me but I in my opinion there
isn't a good way to create forms or should I say, everything else is
so well done that the way you create forms seems to be too cumbersome,
in particular making it so that a pull down menu selects a value that
you assign it.
In any case, does anyone know of any php based (or other readily
accepted web language) solution to creating forms?

Any suggestions are welcome
Jul 17 '05 #1
6 2720
Hello,

On 11/09/2004 01:26 AM, gonzalo briceno wrote:
I have been using phplib for a while and I really like the framework
except for form creation. Maybe it is me but I in my opinion there
isn't a good way to create forms or should I say, everything else is
so well done that the way you create forms seems to be too cumbersome,
in particular making it so that a pull down menu selects a value that
you assign it.
In any case, does anyone know of any php based (or other readily
accepted web language) solution to creating forms?


You may want to try this popular forms generation and validation class:

http://www.phpclasses.org/formsgeneration
--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
Jul 17 '05 #2
I can recommend PEAR. It's allmost PHPLIB compatible, modular and has a form
creation class.

Regards,

Eric Brongers

"gonzalo briceno" <go************ @gmail.com> schreef in bericht
news:5a******** *************** ***@posting.goo gle.com...
I have been using phplib for a while and I really like the framework
except for form creation. Maybe it is me but I in my opinion there
isn't a good way to create forms or should I say, everything else is
so well done that the way you create forms seems to be too cumbersome,
in particular making it so that a pull down menu selects a value that
you assign it.
In any case, does anyone know of any php based (or other readily
accepted web language) solution to creating forms?

Any suggestions are welcome

Jul 17 '05 #3
gonzalo briceno wrote:
I have been using phplib for a while and I really like the framework
except for form creation. Maybe it is me but I in my opinion there
isn't a good way to create forms or should I say, everything else is
so well done that the way you create forms seems to be too cumbersome,
in particular making it so that a pull down menu selects a value that
you assign it.
In any case, does anyone know of any php based (or other readily
accepted web language) solution to creating forms?

Any suggestions are welcome


You could use phpPeanuts, but that will require that you embrace OOP
within the environment (architecture?) of the framework. If you do, it
will not only generate forms with dropdown lists, search dialogs,
checkboxes, and navigational links to related objects, but also convert
datatypes, validate user data, report user data entry mistakes, if no
mistakes modify your objects, save them to MySql, retrieve them, cache
them, search for them, page the results, and generate some default reports.

But OTOH, you need basic OOP knowledge (the website does NOT offer an
entry level course OOP). And still the paradigm leap you have to make
may be a bridge too far. Furthermore you may have trouble integrating it
with existing databases and application code. And once you really get
the hang of it, you are likely to percieve your 'old' code as 'legacy'
that urgently needs refactoring or rebuilding. But OK, if you are
learning rapidly (i believe most people here do) the last will probably
happen anyway ;-)

Greetings,

Henk Verhoeven,
www.phpPeanuts.org.

BTW, there are many more frameworks in php, see
http://www.hotscripts.com/PHP/Script...ork/index.html

Jul 17 '05 #4
Thanks to everyone with replies; I'm looking into your suggestions.
For those that are already using PHPLIB I have the following code to
generate a pull-down menu and have the particular choice <select>ed
assuming that there is a database record with this information. Note
that my code is tab delimited with 2 spaces per tab so if you copy and
paste the code into a text editor everything should look a lot nicer.

1. This is the function(borrow ed from php.net) that queries
table.field and produces an array of values for this field ASSUMING
that it is either of enum or set type.

function mysql_enum_valu es(&$db, $tableName,$fie ldName)
{
$result = $db->query("DESCRIB E $tableName");

//then loop:
while($row = mysql_fetch_arr ay($result))
{
//# row is mysql type, in format "int(11) unsigned zerofill"
//# or "enum('cheese', 'salmon')" etc.

ereg('^([^ (]+)(\((.+)\))?([
](.+))?$',$row['Type'],$fieldTypeSpli t);
//# split type up into array
$ret_fieldName = $row['Field'];
$fieldType = $fieldTypeSplit[1];// eg 'int' for integer.
$fieldFlags = $fieldTypeSplit[5]; // eg 'binary' or 'unsigned
zerofill'.
$fieldLen = $fieldTypeSplit[3]; // eg 11, or 'cheese','salmo n' for
enum.

if (($fieldType==' enum' || $fieldType=='se t') &&
($ret_fieldName ==$fieldName) )
{
$fieldOptions = split("','",sub str($fieldLen,1 ,-1));
return $fieldOptions;
}
}

//if the funciton makes it this far, then it either
//did not find an enum/set field type, or it
//failed to find the the fieldname, so exit FALSE!
return FALSE;
}

2. This is the code that goes into the PHP page that uses PHPLIB's
templates and ooforms. We are using blocks to automate creation of
certain form elements.
include "template.i nc";
$t1 = new Template();
$t1->set_file("MyFi leHandle","pull downs_blocks.ht ml");
$defaults = array (
"message" => "Testing the pull down menu option",
"action" => "inquiry_manage 2.php",
"search_for " => "Search for an inquiry where the person's name is"
);
$t1->set_var($defau lts);
//Pull the 'highest_educat ion' field from the 'Business_Appli cation'
table and show a pull down

$db = new DB_Example();
$result = $db->query("SELEC T `highest_educat ion` , `business_plan` ,
`business_age`
FROM `Business_appli cation`
WHERE `ID` =51");

//if($result)
$row = mysql_fetch_ass oc($result);

foreach ($row as $element => $value) {
//set the blocks
$t1->set_block("MyF ileHandle", "blk_".$element , $element);
//get the choices for Business_applic ation.element to populate the
pull down menu
$choice = mysql_enum_valu es($db, "Business_appli cation",$elemen t);
//output the pull down menu
foreach($choice as $x)
{
if ($x == $value) {
$t1->set_var($eleme nt."_value", "value='".$ x."' selected");
$t1->set_var($eleme nt."_text", $x);
}
else {
$t1->set_var($eleme nt."_value", "value='".$x."' ");
$t1->set_var($eleme nt."_text", $x);
}
$t1->parse($element , "blk_".$element , TRUE);
}
}
$t1->parse("MyOutpu t","MyFileHandl e");
$t1->p("MyOutput" );

3. This is the actual HTML page with the block definitions. Please
note that blocked sections are named 'blk_<element>' and the
corresponding record field is called <element> so that I can parse the
file with the line
$t1->parse($element , "blk_".$element , TRUE);

<table border=0 width="100%">
<tr>
<td>
<SELECT name="highest_e ducation">
<!-- BEGIN blk_highest_edu cation -->
<option {highest_educat ion_value}>{hig hest_education_ text}</option>
<!-- END blk_highest_edu cation -->
</SELECT>
</td>
</tr>
<tr>
<td>
<SELECT name="business_ plan">
<!-- BEGIN blk_business_pl an -->
<option {business_plan_ value}>{busines s_plan_text}</option>
<!-- END blk_business_pl an -->
</SELECT>
</td>
</tr>
<tr><td valign="top">su bmit</td><td><input name='submit'
value='submit' type='submit'></td></tr>
</table>

Henk Verhoeven <ne**@phppeanut sREMOVE-THIS.org> wrote in message news:<cm******* ***@news6.zwoll 1.ov.home.nl>.. .
gonzalo briceno wrote:
I have been using phplib for a while and I really like the framework
except for form creation. Maybe it is me but I in my opinion there
isn't a good way to create forms or should I say, everything else is
so well done that the way you create forms seems to be too cumbersome,
in particular making it so that a pull down menu selects a value that
you assign it.
In any case, does anyone know of any php based (or other readily
accepted web language) solution to creating forms?

Any suggestions are welcome


You could use phpPeanuts, but that will require that you embrace OOP
within the environment (architecture?) of the framework. If you do, it
will not only generate forms with dropdown lists, search dialogs,
checkboxes, and navigational links to related objects, but also convert
datatypes, validate user data, report user data entry mistakes, if no
mistakes modify your objects, save them to MySql, retrieve them, cache
them, search for them, page the results, and generate some default reports.

But OTOH, you need basic OOP knowledge (the website does NOT offer an
entry level course OOP). And still the paradigm leap you have to make
may be a bridge too far. Furthermore you may have trouble integrating it
with existing databases and application code. And once you really get
the hang of it, you are likely to percieve your 'old' code as 'legacy'
that urgently needs refactoring or rebuilding. But OK, if you are
learning rapidly (i believe most people here do) the last will probably
happen anyway ;-)

Greetings,

Henk Verhoeven,
www.phpPeanuts.org.

BTW, there are many more frameworks in php, see
http://www.hotscripts.com/PHP/Script...ork/index.html

Jul 17 '05 #5
.oO(gonzalo briceno)
1. This is the function(borrow ed from php.net) that queries
table.field and produces an array of values for this field ASSUMING
that it is either of enum or set type.

function mysql_enum_valu es(&$db, $tableName,$fie ldName)
{
$result = $db->query("DESCRIB E $tableName");
[...]


You could use the following query to fetch informations for the
requested field directly:

SHOW COLUMNS FROM $tableName LIKE '$fieldName'

Then parse the returned Type-field.

Micha
Jul 17 '05 #6

"gonzalo briceno" <go************ @gmail.com> wrote in message
news:5a******** *************** ***@posting.goo gle.com...
I have been using phplib for a while and I really like the framework
except for form creation. Maybe it is me but I in my opinion there
isn't a good way to create forms or should I say, everything else is
so well done that the way you create forms seems to be too cumbersome,
in particular making it so that a pull down menu selects a value that
you assign it.
In any case, does anyone know of any php based (or other readily
accepted web language) solution to creating forms?

Any suggestions are welcome


I like phpHtmlLib - http://phphtmllib.newsblob.com

The help/documentation is pretty good and there are a number examples you
can
look at.

Mike
--
Mike Walsh - mike_walsh at mindspring.com
Jul 17 '05 #7

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

Similar topics

0
1405
by: Diederick Huijbers | last post by:
Dear reader, For the last three years I'm using the template parser of PHPlib with a lot of pleasure. I think this is still the best mechanism for seperating PHP-code and HTML related code. Of course there are many, many other good parsers but this just my opinion. But a lack of most of the HTML-template parsers is SPEED. When developing big websites all of the template parser are too slow (IMO). Therefore I'm trying to find a group...
2
3339
by: Matthew Clubb | last post by:
Hi, I need help developing an expanding form I've decided that a use of PHP, Mysql and Javascript is the best platform for creating a selection of database interfaces which I'm trying to build for my company. I had been using Microsoft Access, but obviously this requires licenses for every machine. BUT..... I'm look for an easy way of recreating subforms. I'm trying to create a Purchase Order system and in Access I did this by using a...
11
2199
by: xenophon | last post by:
I have a web site with forms authentication and a single logon page. I have 4 subdirectories, each that should be protected by a different username/password combination. For testing purposes, the username/password are hardcoded into the code-behind C# code. How can I write my web.config to make this happen? Thanks.
1
1699
by: YYZ | last post by:
Sorry for the multipost, but no one was responding in the other thread. If any solution is forthcoming, I will return to the original thread and post it there as well. I've created a usercontrol and I'm trying to emulate the look of a mac effect (just for showing some options to my boss) by using 2 gradient rectangles. I'm having a LOT of trouble doing this, however, because I keep getting a 1 or 2 pixel line showing up. Can someone...
6
7247
by: Adam Tilghman | last post by:
Hi all, I have found that IE doesn't seem to respect the <SELECT> "multiple" attribute when set using DOM methods, although the attribute/property seems to exist and is updated properly. Those changes just don't make it onto the screen. Am I doing something wrong here? If not, is there a better feature test I can use than "appName.match()"?
34
3587
by: emrahayanoglu | last post by:
Hello Everyone, Now, I'm working on a new web framework. I tried many test on the other programming languages. Then i decided to use python on my web framework project. Now i want to listen all of you. What do you want in that web framework(Easy use of Database, Easy use of XML, GUI Designer, etc...)? I'm wating your answers. Thank you for all answers...!
5
14114
by: c676228 | last post by:
Hi everyone, my colleagues are thinking about have three insurance plans on one asp page: I simplify the plan as follow: text box:number of people plan1 plan2 plan3
4
3658
by: sklett | last post by:
I've developed an ERP application that we use internally and works quite well. I receiving more and more requests from users to print various transactions, order forms, search results, etc. I haven't decided what the best way to do this is because I don't have much experience with generating printable forms. Early on I knew one of my modules would need to print a clear report so I used the open source SharpPDF library to generate the...
7
1577
by: Cirene | last post by:
How do I change an application to target the .NET 2.0 framework, NOT the ..NET 3 framework? I'm creating a winform app, but I would think it's the same method. The option to change doesn't show up in the properties page of my project.
0
8001
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8424
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8415
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8069
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8286
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6742
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
3912
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3958
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2438
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.