Connecting Tech Pros Worldwide Forums | Help | Site Map

Variable variables used with _POST

Member
 
Join Date: Jan 2007
Posts: 46
#1: Apr 12 '07
Hi,
Is there any way to specify the name of the input object you want the value of through _POST using variable variables? Like this: _POST['input'$variable]
I know this isn't syntactically correct, but is this idea possible, and If so, how?
Thanks,
Austen

code green's Avatar
Expert
 
Join Date: Mar 2007
Location: England
Posts: 1,083
#2: Apr 12 '07

re: Variable variables used with _POST


You could POST an array. Or use common names for your elements with numeric suffixes.
[HTML]<input type="test" name="box1">
<input type="test" name="box2">[/HTML]
Then
[PHP]//Get box 2
$value = $_POST['box'.2];[/PHP]
Reply