2005-April: Form Processing

As promised, our April discussion will be on form processing. We’ll discuss different techniques available and hopefully find some solutions to the common problems we all face when using forms in our web applications.

For now, the [url=http://www.shazpro.com/presentations/kcpug_forms/form_presentation.swf]meeting notes are hosted here[/url].

A [url=http://www.shazpro.com/presentations/kcpug_forms/multipage_register.php]functional example of a multipage form with source code[/url] is also available.

351 thoughts on “2005-April: Form Processing

  1. Re: 2005-April: Form Processing
    Doug,

    I also wanted to thank you for the presentation, once again the PUG has furthered my understanding of PHP and programming techniques. In fact I used some of the methods in a project I did today.

    Thanks again,
    Al

  2. Re: 2005-April: Form Processing
    A neat thing that can be done with form processing is using arrays.

    example:


    php gets this post as $_POST[‘text_variable’] containing the array $textvariable=array(“test1” => “”,”test2″=>””,”chk1″=””);

    Just FYI.

  3. Re: 2005-April: Form Processing
    I copied the sample code and ran it and it generated errors. I have made no changes other than those noted

    Notice: line 147 – Undefined index: page
    line 147 – switch($_REQUEST[‘page’])

    Notice: line 129 – Undefined variable: errors
    line 129 – if ($errors) // Display Errors if there are any

    I corected by changing to
    if (‘$errors’)

    then the wolowing error showed up:

    Debug Warning: line 137 – Variable passed to each() is not an array or object

    line 137 – while(list($key,$message) = each($error_text))

    • Re: 2005-April: Form Processing
      Thanks. Those aren’t really errors though. Those are notices and warnings. The script should still run fine.

      I don’t have error reporting set to that high of a level on my systems, which is why I never saw those notices and warnings.

      You probably don’t want to do what you did on line 129. $errors is supposed to be a bit value (either 1 for true or 0 for false), so changing it to a string may change the result.

      If you don’t want those to show up, you can change your error reporting level, or you can change the code and define those variables at the top of the script. Also, you could put a @ in front to suppress the warning messages.

      For instance,

      while(list($key,$message) = @each($error_text))

      will get rid of your last warning.

Leave a Reply

Your email address will not be published. Required fields are marked *