Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
PHP help... $_POST[var]
Name: delr2691 Date: March 23, 2005 at 13:07:17 Pacific OS: Windows XP PRO CPU/Ram: Intel Pentuim IV 2.6 Gh /
Comment:
Hey, I have a problem, i want to submit data in a db like this: i have input fields which are randomly named... but the name of the fields are stored into an array... for example fields = array('field1', 'field2', 'etc'); and i want to take the fields value to enter it (the value) into a database...
i tried this: foreach ($fields as $field) { $enterField = $_POST["$field"]; $insert = "Insert into bla bla bla"; mysql_query($insert); } but this didn't work... because it is trying to get the value of the field named "$field" which does not exist...! help me with this one pliz... thanx
--------------------- Diego Luces delr_91@hotmail.com
Name: Laler Date: March 23, 2005 at 15:01:19 Pacific
Reply:
hello,
Im not relly sure about this because you didn't tell us how'd you pass the field name from the form -> to the processor script... you sure the 'randomized' vars in the processor will have values?
---
you can use vars as an array index, just don't use quote -> $enterField = $_POST[$field];
Summary: Hi, I'm helping a friend out with his tab site and trying to get some practice in with php and I think I've come a little unstuck... Basically, I have a form for adding an album by a band, you select ...
Summary: Ok I'm rather new to php, go figure :) Anyway I'm trying to lord certain pages into tables using include, though the problem I'm having is it will work when I test it locally though it doesn't work wh...
Summary: JavaScripters, This question is in regards with a JavaScript script within a PHP page. I included everything in case a complete understanding is required for a correct response. Thanks in advance. ...