form values into an array

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
cto1mac
Forum Commoner
Posts: 54
Joined: Tue Jan 27, 2004 6:11 am
Location: Virginia Beach, VA

form values into an array

Post by cto1mac »

I have a client that has a huge form (60+ values) is there any way to make a script that will take all of those form values and put them into an array??

Thanks
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

Post by kettle_drum »

Code: Select all

$myOwnArray = $_POST;
$myOwnArray = $_GET;
??
User avatar
cto1mac
Forum Commoner
Posts: 54
Joined: Tue Jan 27, 2004 6:11 am
Location: Virginia Beach, VA

Post by cto1mac »

so will creating the array this way keep me from having to manually enter:

Code: Select all

<?php
$myArr = array('$_POST[var1]', '$_POST[var2]'.....);

?>
it will do that for me??
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

Post by kettle_drum »

Yeah. It will copy everything that is in $_POST.

Code: Select all

$myOwnArray = $_POST;
print_r($_POST);
print_r($myOwnArray);
Test it for yourself :)
Post Reply