dcole.ath.cx Posted April 16, 2006 Share Posted April 16, 2006 Can I go...$get = $blah[0];$info = $_POST["$get"];...I get error: Undefined index: 482214482214 is the name of the form name Link to comment Share on other sites More sharing options...
reportingsjr Posted April 16, 2006 Share Posted April 16, 2006 $_POST is for getting variables from another page.. just use: $get = $blah[0]$info = $get its the same thing I think you want to do.. Link to comment Share on other sites More sharing options...
dcole.ath.cx Posted April 17, 2006 Author Share Posted April 17, 2006 umm... dynamic $_POST...I'm trying to get the post from another page except I don't kow what the names of the things are... so I can't go $_POST['blah']. I have to open a file and get a list of names, then load all the names from the other page and see if they equal 1 or 0.so I need a $_POST_EVERYTHING_THE_FORM_HAS() or do a dynamic way. Link to comment Share on other sites More sharing options...
Little Goat Posted April 18, 2006 Share Posted April 18, 2006 (edited) use a foreach statement like this: <?php foreach ($_POST as $key => $value){ echo " <tr><td>"; echo htmlspecialchars($key,ENT_QUOTES); echo "</td><td>"; echo htmlspecialchars($value,ENT_QUOTES); echo "</td></tr>"; }?> no matter what you send it, this code will echo it all. (post-echo)LG Edited April 18, 2006 by Little Goat Link to comment Share on other sites More sharing options...
justsomeguy Posted April 19, 2006 Share Posted April 19, 2006 You can use this function to bring all request variables into the global scope:http://www.php.net/manual/en/function.impo...t-variables.phpOnce you do that, you would have to use 'variable variables' to refer to the individual request variables: inport_request_variables("p", "varprefix_");$varname = "varprefix_" . $fileinfo[0];echo "the value of {$varname} is {$$varname}"; //note the double $ signs More on variable variables:http://www.php.net/manual/en/language.variables.variable.phpHowever, your example should still work. You should also be able to do this: $varname = $fileinfo[0];echo $_POST[$varname]; If you are getting an array index error, you could try changing the error reporting in php.ini to not report those errors (the value would just be ""), or you can also check to see if the value has been set before using it: $varname = $fileinfo[0];if (isset($_POST[$varname])){ echo $_POST[$varname];} More on the isset function:http://www.php.net/manual/en/function.isset.php Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now