This is my php file I want to insert value of the status in two row at the same time.
<?php
include_once 'db_connect.php';
if(isset($_POST['btn-signup']))
{
$PersonID = mysql_real_escape_string($_POST['PersonID']);
$FirstName = mysql_real_escape_string($_POST['FirstName']);
$Status = mysql_real_escape_string($_POST['Status']);
$uname = trim($uname);
$email = trim($email);
$upass = trim($upass);
// email exist or not
$query = "SELECT PersonID FROM attandance WHERE PersonID='$PersonID'";
$result = mysql_query($query);
$count = mysql_num_rows($result); // if email not found then register
if($count == 0){
if(mysql_query("INSERT INTO state(PersonID,FirstName,Status) VALUES('$PersonID','$FirstName','$Status')"))
{ ?>
<script>alert('successfully Added ');</script>
<?php
}
else
{ ?>
<script>alert('error while registering you...');</script>
<?php
}
}
else
{
?>
<script>alert('Sorry PersonID already taken ...');</script>
<?php
}
}
echo "<!DOCTYPE html>\n";
echo "<html>\n";
echo "<head>\n";
echo " <meta charset=\"utf-8\">\n";
echo " <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n";
echo " <title>AdminLTE 2 | Blank Page</title>\n";
echo "</head>\n";
echo "<body>\n";
echo " \n";
echo "\n";
echo "\n";
include_once 'dbconnect.php';
$query = "SELECT * FROM attandance ";
$result = mysql_query($query);
echo "<table border=\"2\">\n";
echo " <tr>\n";
echo " <th>PersonId</th>\n";
echo " <th>First Name</th>\n";
echo " <th>Status</th>\n";
echo " </tr>\n";
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$PersonID=$row['PersonID'];
$FirstName=$row['FirstName'];
echo "<td> <input type=\"text\" name=\"user_id\" value=\" $PersonID\"> </td>\n";
echo "<td> <input type=\"text\" name=\"full_name\" value=\" $FirstName\"></td>\n";
echo "<td> <input type=\"text\" name=\"full_name\" value=\" $Status\"></td>\n";
echo "</tr>\n";
}
echo " </table>\n";
echo "<input id=\"button\" type=\"submit\" name=\"btn-signup\" value=\"Sign-Up\">\n";
echo "</body>\n";
echo "</html>\n";
echo "\n";
?>
I want to add the status of both field at once using the button. But it is not working. Can anyone help me. In the state table I want to add values to two rows at the same time.