I want to insert fid
and io_id
values into a table named temp_fir_accept_later
and here io_id
is a new field so it directly gets entered to database table successfully. But the fid
value is grabbed from another previously made table named fir
, so when I submit both values, fid
shows Error as:
"Notice: Undefined variable: fid in C:\wamp\www\myProjectMJb\dashboard\admin_dashboard_menus\fir_accept_later.php on line 17"
.
So how can I fix that problem? Below I have shown my code:
fir_accept.php
<?php
include("connectioni.php");
$edit_record = $_GET['edit'];
$rs=mysqli_query($con,"SELECT * FROM `fir` WHERE fid='$edit_record'");
while($row=mysqli_fetch_array($rs))
{
?>
<form action="fir_accept_later.php" method="POST">
FIR id:<br>
<input type="text" name="fid" value="<?php echo $row['fid']; ?>" disabled><br>
Assigned IO id:<br>
<input type="text" name="io_id" ><br><br>
<button type="submit" name="submit">Submit</button><br>
</form>
fir_accept_later.php
<?php
include('connectioni.php');
$dbname="crime_management";
$conn=mysqli_connect($servername, $username,$password,$dbname);
mysqli_select_db($conn,$dbname);
if(isset($_POST['submit'])){
if (isset($_POST['fid']))
{
$fid = $_POST['fid'];
}
$io_id = $_POST['io_id'];
$register_query="INSERT INTO `temp_fir_accept_later`(`fid`, `io_id`) VALUES ('$fid','$io_id')";
mysqli_query($conn,$register_query);
if($register_query){
echo "Data Entered Successfully!";
}
else {
echo "Failed!!!";
}
}
?>