Trying to do two difference frame.src in the script but still not working.
If I change the file path which is `/qcpl/Backend/ to another filepath, it hiust changes the filepath of the first popup button. What I want to happen is two difference file path since two different pop up button but only one is working and the other is saying forbidden error in php.
The first file path for the pop up button is just an alternate path but is 100 percent working but in the second button, i’m using a full path and literal not working and says forbidden. can someone help?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title> BOSS 2 </title>
<!-- ======= Styles ====== -->
<link rel="shortcut icon" type="image/x-icon" href="imgs/logo.png">
<link rel="stylesheet" href="boss2accountlocator.css">
<!-- ======= Boxiocns ====== -->
<link href='https://unpkg.com/[email protected]/css/boxicons.min.css' rel='stylesheet'>
</head>
<body>
<!-- =============== Navigation ================ -->
<div class="sidebar close">
<div class="logo-details">
<span class="img">
<img src="imgs/logo.png" >
</span>
<span class="logo_name">Quezon City Public Library</span>
</div>
<ul class="nav-links">
<li>
<div class="iocn-link">
<a href="boss2account.php">
<i class='bx bx-file-blank' ></i>
<span class="link_name">Document</span>
</a>
<i class='bx bxs-chevron-down arrow' ></i>
</div>
<ul class="sub-menu">
<li><a href="boss2incoming.php">Incoming</a></li>
<li><a href="boss2outgoing.php">Outgoing</li>
</ul>
</li>
<li>
<a href="/qcpl/Backend/logout.php">
<i class='bx bxs-log-out' ></i>
<span class="link_name">Sign Out</span>
</a>
</li>
</li>
</ul>
</div>
<!-- ========================= Main ==================== -->
<section class="home-section">
<div class="home-content">
<i class='bx bx-menu' ></i>
</div>
<!-- ========================= Boss2 Locator ==================== -->
<div class="details">
<div class="upload">
<div class="cardHeader">
<h2>DOCUMENTS</h2>
<div class="info_box2">
<?php
if(isset($_GET['locator_num'])){
$locatorNum = $_GET['locator_num'];
echo "<h4>Locator Number: $locatorNum</h4>";
else {
echo "Locator number not provided.";
?>
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "qcpl";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$locator_num = isset($_GET['locator_num']) ? $_GET['locator_num'] : 'Not provided';
$sql = "SELECT `locator_num`, `category`, `subject`,
`description`, `received_from`, `received_date`,
`usercomment`, `proofreader_comment`,
`boss2_comment`, `boss1_comment`, `type`,
`file_path`, `revise_filepath`, `status`
FROM fileupload
WHERE `locator_num` = '$locator_num'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
echo "<table border='1'>";
while($row = $result->fetch_assoc()) {
echo "<ab>Category: " . $row["category"] . "</ab>";
echo "<ab>Subject: " . $row["subject"] . "</ab>";
echo "<ab>Description: " . $row["description"] . "</ab>";
echo "<ab>Receive from: " . $row["received_from"] . "</ab>";
echo "<ab>Receive Date: " . $row["received_date"] . "</ab>";
echo "<ab>User Comment: " . $row["usercomment"] . "</ab>";
echo "<ab>Proofreader Comment: " . $row["proofreader_comment"] . "</ab>";
echo "<ab>Boss 2 Comment: " . $row["boss2_comment"] . "</ab>";
echo "<ab>Boss 1 Comment: " . $row["boss1_comment"] . "</ab>";
echo "<ab>File Type: " . $row["type"] . "</ab>";
echo "<td><center>Original File: <a href='#' onclick='openPopup("" . $row["file_path"] . "")'>View File</a></td>";
echo "<td><center>Revised File: <a href='#' onclick='openPopup("" . $row["revise_filepath"] . "")'>View File</a></td>";
echo "<ab>Status: " . $row["status"] . "</ab>";
}
} else {
echo "0 results";
}
$conn->close();
?>
</div>
</div>
</div>
<div class="table">
<table class="table_th">
<divdiv id="multiStepForm">
<div>
<div id="overlay"
style="display:none; position: fixed; top: 0;
left: 0; width: 100%; height: 100%;
background-color: rgba(0, 0, 0, 0.8);
justify-content: center;
align-items: center;">
<div style="position: relative; width: 80%; height: 80%; background-color: #fff; padding:25px; border-radius: 8px;">
<iframe id="popupFrame" style="width: 100%; height: 100%;"></iframe>
<span class="close-btn" onclick="closePopup()" style="position: absolute; top: 1px; right: 10px; font-size: 24px; cursor: pointer; color: #888;">×</span>
</div>
</div>
<html>
<head>
<title>Boss 2 Locator</title>
</head>
<body>
<form action="/qcpl/Backend/boss2backend.php" method="POST">
<input type="hidden" name="locator_num" value="<?php echo $locatorNum ?>">
<br>
<label for="comment1" required>Comment:</label><br>
<textarea id="comment1" name="comment1" rows="4" cols="50" required></textarea>
<br>
<br>
<input type="submit" value="Submit" name="submit">
</form>
</body>
</html>
<script>
function viewDocument() {
window.open('document_path', '_blank');
}
</script>
</body>
</html>
<!-- ========================= Script ==================== -->
<script src="main.js"></script>
<script>
function openPopup(filePath) {
var overlay = document.getElementById('overlay');
var frame = document.getElementById('popupFrame');
frame.src = '/qcpl/Backend/' + filePath;
overlay.style.display = 'flex'; // Display the overlay
}
function closePopup() {
var overlay = document.getElementById('overlay');
overlay.style.display = 'none'; // Hide the overlay
}
</script>
<!-- ========================= Ionicons ==================== -->
<script type="module" src="https://unpkg.com/[email protected]/dist/ionicons/ionicons.esm.js"></script>
<script nomodule src="https://unpkg.com/[email protected]/dist/ionicons/ionicons.js"></script>
</body>
</html>
Juluis Tadena is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
5