LiamProductions Posted July 26, 2007 Share Posted July 26, 2007 hey. I was just wondering, some PHP servers like mine have Register Globals turned off. So you have to type something like $name = $_POST['name']; to get the data from the other page is there one line i can write so it gets all the data? if you know what i mean Quote Link to comment Share on other sites More sharing options...
yarnold Posted July 26, 2007 Share Posted July 26, 2007 I suppose you could try (note: not tested) <?php foreach($_POST as $key => $value) { $$key = $value; } ?> Quote Link to comment Share on other sites More sharing options...
akitchin Posted July 26, 2007 Share Posted July 26, 2007 alternatively, you could use the extract() function. why is it necessary to make the variables local? Quote Link to comment Share on other sites More sharing options...
LiamProductions Posted July 26, 2007 Author Share Posted July 26, 2007 Ill just stick to grabbing the data with $var = $_POST['name']; Quote Link to comment Share on other sites More sharing options...
PC Nerd Posted July 26, 2007 Share Posted July 26, 2007 yes, however the idea of an array is to be able to easily manage that arge amount of data. If youve got heaps of variables, then its harder to read your code later on. What are you doing with your $_POST data? sometimes its helpful to use variables, other times it seasier to use teh array. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.