database array to variable name
Posted: Tue Jul 05, 2011 7:16 pm
I use a database to create several form fields. The database gives me numbers that I add a couple of letters to and create radio buttons.
The database may give me rdid = 4, 8, 24. I use this to create radio buttons. and repeat this with the other numbers.
I submit this to the next page and I want to get the value of these variables. I know rdid = 4, 8, 24 but I do not know how to get this variable. I have tried this but I am missing something.
The database may give me rdid = 4, 8, 24. I use this to create radio buttons.
Code: Select all
$name=sc4; <INPUT Type='Radio' Name='$name'>I submit this to the next page and I want to get the value of these variables. I know rdid = 4, 8, 24 but I do not know how to get this variable. I have tried this but I am missing something.
Code: Select all
$query3 = "SELECT * FROM table where rid LIKE '$rid'";
$result3 = mysql_query($query3) or die(mysql_error());
while($rdid = mysql_fetch_array($result3)){
$sc="sc" . $rdid['rdid'];
$score=$_POST['sc'];
echo "$sc - $score<br>";
}