I have checked online for at least three hours on a possible solution or workaround, but there doesn't seem to be anything working so far. I am quite new to all these platforms. I have two PHP files - the first is to log in and check the record from the database, and the second to display a set of query results based on the inputted info from the first page.
In the html section of my first php page, it goes like this:
<form role="form" method="post" action="view_users.php">
<fieldset>
<div class="form-group">
<input class="form-control" placeholder="Course Number" name="courseNumber" type="text" autofocus>
</div>
<div class="form-group">
<input class="form-control" placeholder="Section" name="section" type="text" autofocus>
</div>
<div class="form-group">
<input class="form-control" placeholder="Student ID" name="studentId" type="text" id="studentId" autofocus>
</div>
<input class="btn btn-lg btn-success btn-block" type="submit" value="View Scores" name="register" >
</fieldset>
</form>
And then in the lower part,
<?php
include("database/db_conection.php");
$courseNumber=$studentId=$section="";
if(isset($_POST['register']))
{
if ($_SERVER["REQUEST_METHOD"] == "post")
{
$courseNumber=$_POST['courseNumber'];
$studentId=$_POST['studentId'];//same
$section=$_POST['section'];//same
The second PHP file, view_users.php, is supposed to receive the three columns above from the first PHP file with below:
<?php
include("database/db_conection.php");
$view_users_query="select a.Q1, a.LAB1, a.LABEXER1, a.PE from ES201_M2_CS a inner join ES201 b on a.cid = b.cid where b.section = '$section' and b.sid = '$studentId';"; //line 41
$run=mysqli_query($dbcon,$view_users_query);
I am encountering the error, however.
Notice: Undefined variable: section in /home/public_html/es201/view_users.php on line 41
Notice: Undefined variable: studentId in /home/public_html/es201/view_users.php on line 41
I have exhausted all the solutions that I found online, but to no avail. I tried printing the $POST value in the first PHP and all the inputted details were captured. However, in the second, all values would only display as NULL. I would appreciate any enlightenment on this. Thank you very much!