Page 1 of 1

Variable Question

Posted: Sat Dec 17, 2011 5:25 am
by spacebiscuit
Hi,

I am processing the input from a web form:

Variables are named as follows:

data1
data2
data3

I am using a loop to process the data.

$_POST[data.$y]

I don't think this is quite right though - how do I use the value of a variable in a variable name.

Thanks,

Re: Variable Question

Posted: Sat Dec 17, 2011 5:47 am
by social_experiment

Code: Select all

<?php
 $_POST['data' . $y];
?>
Place the non-variable part in single or double quotes

Re: Variable Question

Posted: Sat Dec 17, 2011 6:46 am
by spacebiscuit
Thanks