OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
php-general Digest 20 Nov 2006 04:46:04 -0000 Issue 4469

php-general-digest-helplists.php.net
Date: Sun Nov 19 2006 - 22:46:04 CST


php-general Digest 20 Nov 2006 04:46:04 -0000 Issue 4469

Topics (messages 244848 through 244854):

Re: PHP Programmers
        244848 by: Robert Cummings

HTML Forms, PHP Question
        244849 by: Stephen
        244850 by: Robert Cummings
        244851 by: tedd

Re: regular expressions
        244852 by: Al
        244853 by: Børge Holen

Coding Standards Document
        244854 by: John Comerford

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


On Sat, 2006-11-18 at 20:44 -0800, benc11gmail.com wrote:
> Thanks everyone for the responses. I am a programmer myself, however, I
> have so much to do but not enough time. I am working on 3 big projects and
> will be needing some help. I am not sure how to split up the projects to
> track their status and to see how everything is going overall. I was told
> jotspot was a good tool, but it is closed due to the acquisition by Google.
> If anyone has been faced by this problem, I would be very interested to see
> how they worked through this. I should be organized and ready to go in the
> next couple weeks.

Presumably you're already using something like CVS or SubVersion and you
are inquiring about some kind of task management system. I've been using
the Mantis bug tracking system for a while with some customers. We don't
just use it for bugs though, we also use it to request new tasks and
discuss stuff. Your mileage may vary :)

    http://www.mantisbt.org/

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


Hi

First question to the list.

I am writing a control panel for a web site and there will be about 20
HTML forms.

Instead of creating 20 PHP files to process the submit data, is there a
way that I can do this with a single PHP file.

Either specify a specific function for each form, or use a case
statement somehow to direct to the function.

Thanks!
Stephen

attached mail follows:


On Sun, 2006-11-19 at 11:00 -0500, Stephen wrote:
> Hi
>
> First question to the list.
>
> I am writing a control panel for a web site and there will be about 20
> HTML forms.
>
> Instead of creating 20 PHP files to process the submit data, is there a
> way that I can do this with a single PHP file.
>
> Either specify a specific function for each form, or use a case
> statement somehow to direct to the function.

Yes...

<?php

$handlers = array
(
    'myLoginForm' => 'handler_myLoginForm',
    'myRegistrationForm' => 'handler_myRegistrationForm',
    'myProfileForm' => 'handler_myProfileForm',
    'myDonationForm' => 'handler_myDonationForm',
);

$action = isset( $_POST['formName'] ) ? $_POST['formName'] : null;

if( isset( $handlers[$action] ) )
{
    $handlers[$action]( $_POST );
}

function handler_myLoginForm( $form )
{
    print_r( $form );
}

function handler_myRegistrationForm( $form )
{
    print_r( $form );
}

function handler_myProfileForm( $form )
{
    print_r( $form );
}

function handler_myDonationForm( $form )
{
    print_r( $form );
}

?>

Alternatively you can use the following style:

<?php

$action = isset( $_POST['formName'] ) ? $_POST['formName'] : null;

if( $action && function_exists( ($handler = 'handler_'.$action) ) )
{
    $handler( $_POST );
}

if( isset( $handlers[$action] ) )
{
    $handlers[$action]( $_POST );
}

function handler_myLoginForm( $form )
{
    print_r( $form );
}

function handler_myRegistrationForm( $form )
{
    print_r( $form );
}

function handler_myProfileForm( $form )
{
    print_r( $form );
}

function handler_myDonationForm( $form )
{
    print_r( $form );
}

?>

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


At 11:00 AM -0500 11/19/06, Stephen wrote:
>Hi
>
>First question to the list.
>
>I am writing a control panel for a web site and there will be about
>20 HTML forms.
>
>Instead of creating 20 PHP files to process the submit data, is
>there a way that I can do this with a single PHP file.
>
>Either specify a specific function for each form, or use a case
>statement somehow to direct to the function.
>
>Thanks!
>Stephen

Stephen:

Not a problem, I use one php script to handle many forms using a case
statement. You can use sessions or pass a POST/GET variable to itself
to know which form to present.

tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com

attached mail follows:


Get "Sams, Teach yourself Regular Expressions" It's a great little, simple book.

Then get the Regex Coach. Google to find it. It's free, works great and is
super for learning regex

Børge Holen wrote:
> Ok I seem to need to learn regular expressions more than anything.
>
> this is what im working on:
>
> ["desc"] = " <c> FFFFFF topic <c> 999999 rest of the text ",
>
> $string = preg_replace("/<c>\s\w[0-9A-F]+/","",$string);
>
> prints out: topic rest of the text ( with double spaces :(, I thought
> \s would fix that )
>
> however how would I go on this:
>
> <font color="colorcode">topic</font>
> <font color="colorcode">rest of thetext</font>
>
> Almost anything I do with the above statement either throws me off with a
> modifier error or prints out what it should not
>
>
> ---
> Børge
> Kennel Arivene
> http://www.arivene.net
> ---

attached mail follows:


On Sunday 19 November 2006 23:25, Al wrote:
> Get "Sams, Teach yourself Regular Expressions" It's a great little, simple
> book.

I'll look that one up. Thank you =)

>
> Then get the Regex Coach. Google to find it. It's free, works great and is
> super for learning regex

And this one, I'm on right now. =) also thanks.

>
> Børge Holen wrote:
> > Ok I seem to need to learn regular expressions more than anything.
> >
> > this is what im working on:
> >
> > ["desc"] = " <c> FFFFFF topic <c> 999999 rest of the text ",
> >
> > $string = preg_replace("/<c>\s\w[0-9A-F]+/","",$string);
> >
> > prints out: topic rest of the text ( with double spaces :(, I
> > thought \s would fix that )
> >
> > however how would I go on this:
> >
> > <font color="colorcode">topic</font>
> > <font color="colorcode">rest of thetext</font>
> >
> > Almost anything I do with the above statement either throws me off with a
> > modifier error or prints out what it should not
> >
> >
> > ---
> > Børge
> > Kennel Arivene
> > http://www.arivene.net
> > ---

--
---
Børge
Kennel Arivene
http://www.arivene.net
---

attached mail follows:


Is there a coding standards document out there that is considered the
'norm' ? I am new to PHP and would like to implement a coding standard
consistent with the way the community codes (if possible).

TIA,
  John