Okay, so I have a page that calls a list of information from a msyql database. say, i have a table called TABLE with columns id, name, phone numbers, and a radio button group (home,cell,work) etc. I've created a script that prints out in a table the name, phone number, and "status (not sure what best to call this, but it's the value of the radio buttons) the radio buttons. What I would like to do is make it so that for each row, if i assign a value to the radio buttons, it will edit the status part. so say, on row 1, i click home, and row 2, cell, and row 3 home... and so forth, and i hit a submit button it will update the database.
So, this is my code for the radio button section in the table. This is under a php tag
What I ended up doing basically is calling each group of radio buttons, status_type1, status_type2, status_type3... basically radio name='status_type".$info['id']."
I want to do an if statement to see if there are values assigned from any clicks on the buttons, then submit them for entry. This is what I have so far.
//Radio Button Template
<fieldset>
<input type='radio' id='status_type_home' name='status_type".$info['id']."' value='home' />
<label for='status_type_home'>home</label>
<input type='radio' id='status_type_work' name='status_type".$info['id']."' value='work' />
<label for='status_type_work'>work</label>
<input type='radio' id='status_type_cell' name='status_type".$info['id']."' value='cell' />
<label for='status_type_cell'>cell</label>
</fieldset>
</td>";
//If statement to submit radio buttons
if ($_POST['status_type "$info['id']"'])
{
$edit_status_sql="UPDATE status SET type = 'status_type".$info['id'] . "' WHERE id = '" . $id . "'";
$edit_status_res=mysqli_query($connection, $edit_status_sql) or die(mysqli_error($connection));
}
The problem I have is basically, I've declared the name of the radio buttons as status_type[variable based on the id]. Unfortunately, this doesn't work. I was wondering if anyone could help me figure out how i'm supposed to format it or if it's even possible to declare a variable within a variable. Thanks!