I want to store data in a variable in echo
I`m just sharing my code below
echo "
<div class='student-input'>
<input type='text' id='fee' class='form-control' name='fee' value='$fee'>
</div>
";
Here I want to fetch the input data but as it is in echo, php can`t read my $fee=$_post method, how could I store the input data into a variable? so that I could pass the value to another file
<h2>Student Approval</h2>
<form method='post'>
<?php $servername="localhost";
$username="root";
$password="";
$database="itswebycom_Registration";
//create connection
$conn = new mysqli($servername,$username,$password,$database);
$successMessage="";
$name= $_SESSION ['auth_user']['name'];
$id= $_SESSION ['auth_user']['id'];
if ($_SERVER['REQUEST_METHOD']=='GET'|| $_SERVER['REQUEST_METHOD']=='POST' ){
$sql1="SELECT * FROM student_reg_pending WHERE ins_name='$name' and ins_id='$id' ";
$result1= $conn->query($sql1);
if(!$result1){
die("Invalid query: ".$connection->error);
}
while($row=$result1->fetch_assoc()){
$fee="";
echo "
<div class='student-row'>
<div class='student-name'>$row[name]</div>
<div class='student-input'>
<input type='text' id='fee' class='form-control' name='fee' value='$fee'>
</div>
<div class='student-buttons'>
<button class='approve-btn' type='submit' name='approve' id='approve'><a href='stu-reg.php?fee=$f & name=$row[name] & pending=approve & ins_name=$row[ins_name] & ins_id=$row[ins_id]'>Approve</a></button>
<button class='decline-btn' name='decline' type='submit' id='decline'><a href='stu-reg.php?name=$row[name] & pending=decline & ins_name=$row[ins_name] & ins_id=$row[ins_id]'>Decline</a></button>
</div>
</div>
";
} } ?></form></div>
echo "
<div class='student-row'>
<div class='student-name'>$row[name]</div>
<div class='student-input'>
<input type='text' id='fee' class='form-control' name='fee' value='$fee'>
</div>
";
i have tried $fee=$_POST[‘fee’]; but the didn`t get stored and shows undefined variable fee