Forum Moderators: coopster
I am writing a PHP function that takes the results of an SQL query, and puts them in either a table, checkbox form, or radio button form.
There are variables that are sent to the function that tell it to make it a form, radio button, etc.
What I am trying to do is send a variable to the function, which represents a location in an array. I am doing this in order to give my checkbox and radio button sections a "value".
What I did was just send a number as the variable, which I want pointing to a location in an array. I am having some trouble pointing to it, though. I am not sure if what I am trying is even possible with PHP.
What I have is this:
while ($row = mssql_fetch_assoc($result))
{
echo"<tr>";
if ($form ==1 && $tabletype =="radio" ¦¦ $form ==1 && $tabletype =="checkbox") //If item is a form, and a checkbox or radio button
{
echo"<td><input type='$tabletype' name='selection' value='";
echo $row[$itemvalue];
echo "'";
}
NOTE: $tabletype is another variable that is sent to determine whether it is a table to checkbox.
I have tried it several different ways. When I just try
$test = $row[$itemvalue];
$test is NULL.
Is what I am trying to do possible? If so, what am I missing?