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 Link to comment https://forums.phpfreaks.com/topic/61928-quick-question/ 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; } ?> Link to comment https://forums.phpfreaks.com/topic/61928-quick-question/#findComment-308348 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? Link to comment https://forums.phpfreaks.com/topic/61928-quick-question/#findComment-308350 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']; Link to comment https://forums.phpfreaks.com/topic/61928-quick-question/#findComment-308364 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. Link to comment https://forums.phpfreaks.com/topic/61928-quick-question/#findComment-308373 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.