RE: [PHP] Pulling variables from $_POST

From: Date: Tue, 22 Apr 2003 02:59:15 +0000
Subject: RE: [PHP] Pulling variables from $_POST
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-144756@lists.php.net to get a copy of this message
If you must... www.php.net/extract ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ > -----Original Message----- > From: Barry L. Jeung [mailto:bjeung@teamlynx.com] > Sent: Monday, April 21, 2003 10:56 PM > To: php-general@lists.php.net > Subject: [PHP] Pulling variables from $_POST > > Ok guys, haven't touched PHP in a while, and I just picked up an old > project I started awhile back. (prior to the 4.1.x default of > register_globals off). I've been familiarizing myself with ways to redo > some things in my old scripts, but I've run into a block (probably just > a mind block) and was hoping someone can help. I'm taking form data and > entering into my db. My old query was this: > > $query = "update table set Name = '$Name', Email = '$Email', Phone = > '$Phone', Fax = '$Fax', Notes = '$Notes' where ID = > '$id'"; > > > My new query is this: > > $query = "update table set Name = " . $_POST["Name"] . " , Email = > " . > $_POST["Email"] . " , Phone = " . $_POST["Phone"] . " > , Fax = " . $_POST["Fax"] . " , Notes = " . $_POST["Notes"] > . " where > ID = " . $_POST["id"]; > > Now that I've gotten this far, I'm not looking forward to redoing all my > other queries, nor typing all that crap in for each new query. So my > question is; is there a way to pull the $_POST data into an array or > some how reassign it to the original variables like so "$Name = > $_POST["Name"]" but without doing that manually. I'm sure there is some > sort of loop or other way of expanding that data, but this is my first > day back and I'm at wit's end. More than happy to read and explanation > if someone has a quick link, rather than typing a full explanation here. > Thanks for your time.

« previous php.general (#144756) next »