A PHP Error was encountered

Severity: 8192

Message: Methods with the same name as their class will not be constructors in a future version of PHP; Waterfall_Cache has a deprecated constructor

Filename: _common/waterfall_cache.php

Line Number: 47

A PHP Error was encountered

Severity: 8192

Message: Methods with the same name as their class will not be constructors in a future version of PHP; Cache_System has a deprecated constructor

Filename: _common/waterfall_cache.php

Line Number: 194

A PHP Error was encountered

Severity: 8192

Message: Methods with the same name as their class will not be constructors in a future version of PHP; Memcache_Cache_System has a deprecated constructor

Filename: _common/waterfall_cache.php

Line Number: 275

A PHP Error was encountered

Severity: 8192

Message: Methods with the same name as their class will not be constructors in a future version of PHP; Filesystem_Cache_System has a deprecated constructor

Filename: _common/waterfall_cache.php

Line Number: 440

A PHP Error was encountered

Severity: 8192

Message: Methods with the same name as their class will not be constructors in a future version of PHP; APC_Cache_System has a deprecated constructor

Filename: _common/waterfall_cache.php

Line Number: 628

Welcome to the World of PHP Page 7

Welcome to the World of PHP Page 7

By Aaron Weiss (Send Email)
Posted Jul 7, 2000


PHP Variables and Web Forms

Note that addToMaillist is a fictional function, that we might have created to place the user's e-mail address into a text file somewhere.

Because PHP migrates form field names into variables, you may wish to construct form field names with an eye toward their resulting data structure in PHP. For example, suppose you have one form that asks for information about a recipient of some sort. You may want to contain that form's values inside a $recipient array, for example, to improve data management inside your PHP script:

<FORM action="process.php3" method="get"> Please enter the recipient's e-mail address: <INPUT type="text" size=20 name="recipient[email]"><BR>
Please enter the recipient's full name: <INPUT type="text" size=20 name="recipient[name]"><BR>
<BR><INPUT type="submit"> </FORM>

process.php3:

<?php while (list($key,$value) = each($recipient)) { print "$key: $value<BR>"; } ?>

The HTML form above was migrated into a PHP array named $recipient with the keys email and name. Above, our PHP code simply reproduces the loop we saw earlier and outputs each key and value in this array, for example (depending on what was submitted in the form):

email: cat@doglover.net name: Mrs. Kitty



NEXT ->



Comment and Contribute

Your name/nickname

Your email

(Maximum characters: 1200). You have characters left.


 

 


Thanks for your registration, follow us on our social networks to keep up-to-date