mardi 9 janvier 2018

How can I fill a database cell with Yes or No by CheckBox in PHP?

I want add a checkbox in every row of a table in php. How can I fill a database cell with Yes or No by CheckBox in PHP? When I change checkbox name for example "name", I have an error.

    <?php
$con=mysql_connect("localhost","biterium_login","login");
mysql_select_db("biterium_login");

// Check connection
if (!$con){
     die("به دلیل مشکل زیر، اتصال برقرار نشد : <br />" . mysql_error());
}

$result = mysql_query("SELECT * FROM member",$con);

$id=$_Get['id'];

echo "<table border='1'>
<tr>
<th>id</th>
<th>name</th>
<th>phone</th>
<th>email</th>
<th>action</th>
<th>action</th>
<th>active</th>
</tr>";

while($row = mysql_fetch_assoc($result)) 
{
    echo "<tr>";
echo "<td>".$row['id']."</td>";
echo "<td>".$row['name']."</td>";
echo "<td>".$row['phone']."</td>";
echo "<td>".$row['email']."</td>";
echo "<td><a href='delete.php?id=".$row['id']."'>Delete</a></td>";
echo "<td><a href='FormUpdate.php?id=".$row['id']."'>Edit</a></td>";
echo "<td><input type='checkbox' value='".$row['id']."'  name='".$row['id']."'></td>";
echo "</tr>";
}
echo "</table>";
?>

<a href='add.html'>ADD</a></td>




Aucun commentaire:

Enregistrer un commentaire