note 77854 added to function.extract

From: Date: Sun, 16 Sep 2007 02:57:50 +0000
Subject: note 77854 added to function.extract
Groups: php.notes 
Request: Send a blank email to php-notes+get-130530@lists.php.net to get a copy of this message
I put two and two together tonight and thought what if... extract($_POST); Now all my form fields are now automatically translated into variable names Example: <form method="POST" action="<?php echo $_SERVER['PHP_SELF'];?>"> <input type="text" name="myField1" value=""> <input type="text" name="myField2" value=""> <input type="text" name="myField3" value=""> <input type="submit" name="submit" value="Submit"> </form> <?php if ($_POST["submit"] != "") { extract($_POST); print $myField1 . ", " . $myField2 . ", and " . $myField3; } ?> Pretty cool stuff. I can't believe I didn't RTFriendlyM sooner! ---- Server IP: 64.71.164.2 Probable Submitter: 70.126.213.28 ---- Manual Page -- http://www.php.net/manual/en/function.extract.php Edit -- https://master.php.net/note/edit/77854 Del: integrated -- https://master.php.net/note/delete/77854/integrated Del: useless -- https://master.php.net/note/delete/77854/useless Del: bad code -- https://master.php.net/note/delete/77854/bad+code Del: spam -- https://master.php.net/note/delete/77854/spam Del: non-english -- https://master.php.net/note/delete/77854/non-english Del: in docs -- https://master.php.net/note/delete/77854/in+docs Del: other reasons-- https://master.php.net/note/delete/77854 Reject -- https://master.php.net/note/reject/77854 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#130530) next »