note 69374 added to tutorial.forms

From: Date: Sat, 02 Sep 2006 16:52:11 +0000
Subject: note 69374 added to tutorial.forms
Groups: php.notes 
Request: Send a blank email to php-notes+get-116636@lists.php.net to get a copy of this message
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. ---- Server IP: 66.163.161.117 Probable Submitter: 62.193.102.124 ---- Manual Page -- http://www.php.net/manual/en/tutorial.forms.php Edit -- https://master.php.net/note/edit/69374 Del: integrated -- https://master.php.net/note/delete/69374/integrated Del: useless -- https://master.php.net/note/delete/69374/useless Del: bad code -- https://master.php.net/note/delete/69374/bad+code Del: spam -- https://master.php.net/note/delete/69374/spam Del: non-english -- https://master.php.net/note/delete/69374/non-english Del: in docs -- https://master.php.net/note/delete/69374/in+docs Del: other reasons-- https://master.php.net/note/delete/69374 Reject -- https://master.php.net/note/reject/69374 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#116636) next »