note 129551 added to reserved.variables.server
| From: | davidbyte | Date: | Thu, 06 Jun 2024 13:14:57 +0000 |
| Subject: | note 129551 added to reserved.variables.server | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-221354@lists.php.net to get a copy of this message | ||
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$courseid = $_POST['courseid']; // Retrieve course ID from form submission
// SQL query to select student IDs for the given course ID
$sql = "SELECT STUDENTID FROM ENROLMENT WHERE COURSEID = '$courseid'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// Output data of each row
while($row = $result->fetch_assoc()) {
echo "STUDENTID: " . $row["STUDENTID"]. "<br>";
}
} else {
echo "No students found for COURSEID: $courseid";
}
// Display the form again with the course ID
echo '<form method="post" action="Question5.php">
<input type="text" name="courseid"
value="'.$courseid.'">
<input type="submit" value="Submit">
</form>';
} else {
// Display the form for the first time
echo '<form method="post" action="Question5.php">
<input type="text" name="courseid">
<input type="submit" value="Submit">
</form>';
}
$conn->close();
?>
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.137 (proxied: 1.40.161.252)
----
Manual Page -- https://php.net/manual/en/reserved.variables.server.php
Edit -- https://main.php.net/note/edit/129551
Del: integrated -- https://main.php.net/note/delete/129551/integrated
Del: useless -- https://main.php.net/note/delete/129551/useless
Del: bad code -- https://main.php.net/note/delete/129551/bad+code
Del: spam -- https://main.php.net/note/delete/129551/spam
Del: non-english -- https://main.php.net/note/delete/129551/non-english
Del: in docs -- https://main.php.net/note/delete/129551/in+docs
Del: other reasons-- https://main.php.net/note/delete/129551
Reject -- https://main.php.net/note/reject/129551
Search -- https://main.php.net/manage/user-notes.php