Home >> FAQs/Tutorials >> PHP Script Tutorials and Tips >> Index

PHP Script Tips - Processing Web Forms

By: FYICenter.com

Part:   1  2  3  4  5  6  7  8  

(Continued from previous part...)

If you copy this script as submit_comments.php to your Web server, and click the first link, you will get:

  query_string = name=Guest&comment=
    I+want+to+say%3A+%22It%27s+a+good+site%21+%3A-%3E%22
Number of values: 2
  name = Guest
  comment = I want to say: "It's a good site! :->"

If you click the second link, you will get:

  query_string 
    = This+visitor+said%3A+%22It%27s+an+average+site%21+%3A-%28%22
Number of values: 1
  This_visitor_said:_\"It\'s_an_average_site!_:-(\" = 

Now you know that urlencode() all special characters into HEX numbers. To translate them back, you need to apply urldecode().

How To Support Multiple-Page Forms?

If you have a long form with a lots of fields, you may want to divide the fields into multiple groups and present multiple pages with one group of fields on one page. This makes the a long form more user-friendly. However, this requires you to write good scripts that:

  • When processing the first page and other middle pages, you must keep those input values collected so far in the session or as hidden values in the next page form.
  • When processing the last page, you should collect all input values from all pages for final process, like saving everything to the database.

Part:   1  2  3  4  5  6  7  8  


Selected Developer Jobs:

More...