I have been strongly with php issues and i thought i should ask a question, hopefully i get help here.
I have dynamic html form with radio with php variable as input name but am unable to get the value of the radio button. Below are the both php and html codes:
if(isset($_POST["title"])) {
$count = count($_POST["title"]);
for($i=0;$i<$count;$i++) {
if(!empty($_POST["title"][$i])) {
$pid = intval($_POST["pid"][$i]);
$title = $_POST["title"][$i];
$available = $_POST["{$pid}"];
//exit;
$sql = "UPDATE tracks SET title='$title', available='$available', WHERE id='$pid'";
$query = mysqli_query($db_connect, $sql);
}
}
$count++;
}
<table>
<tr>
<td><input name="<?php echo $pid; ?>[]" type="radio"
id="sell<?php echo $pid; ?>" value="Sell"></td>
<td width="27%">
<label for="sell<?php echo $pid; ?>">Sell </label></td>
<td width="4%"><input name="<?php echo $pid; ?>[]"
id="pvcy<?php echo $pid; ?>" type="radio" value="Private"></td>
<td width="17%">
<label for="pvcy<?php echo $pid; ?>">Private</label>
</td>
<td width="4%">
<input name="<?php echo $pid; ?>[]" id="pblc<?php echo $pid; ?>"
type="radio" value="public"></td>
<td width="43%">
<label for="pblc<?php echo $pid; ?>"> Free </label></td>
</tr>
</table>
I am not able to get the value of the radio button from the input name:
name="<?php echo $pid; ?>[]"
Any assistance would be appreciated.