note 69373 deleted from tutorial.forms by nlopess

From: Date: Tue, 19 Sep 2006 15:31:38 +0000
Subject: note 69373 deleted from tutorial.forms by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-117319@lists.php.net to get a copy of this message
Note Submitter: Typer85 at gmail dot com ---- A note when dealing with forms using PHP. The index of the $_POST or $_GET arrays will be equal ONLY to the NAME Attribute of the HTML Form Field. Some people tend to believe that it could be equal to the ID Atttribute of the HTML Form Field but that is not true. For example: --------------------- <input name="Age" type="text" /> <input id="Name" type="text" /> --------------------- <?php // Display Form Fields And Content. print_r( $_POST ); // You should get something like this: //Array { //[ 'Age' ] = somevalue; //} // Notice 'Name' was not in the Array. // That's because it had an ID Attribute not // a NAME Attribute, thus it will be ignored. ?> Just a note for people new to PHP.

« previous php.notes (#117319) next »