Jump to content
  • Who's Online   0 Members, 0 Anonymous, 47 Guests (See full list)

    • There are no registered users currently online

All Activity

This stream auto-updates

  1. Yesterday
  2. the most immediate problem is you are reusing id="updateNotesModal" for two modals. the modal you see is the one defined in get_renewal_details.php, but the javascript code that's running when you click the "update notes" button is what is defined in Renewals.php and this doesn't match the elements in the modal that is displayed. best suggestion is that get_renewal_details.php should only get and display the details. there should only be one id="updateNotesModal" modal defined, so there won't be any confusion about which one gets displayed and operated on.
  3. I'm getting a lot of this... The GROUP BYs are what is causing this, at least that's what reflected in the errors. The above code, doesn't have a current instance, but it still shouldn't throw an error. I'm not sure if anything has changed with PHP 8.2 or MySQL 8+ to cause these errors. I read something about a column in the GROUP BY not specifically called in the SELECT. I would say that has never given me an error before, even though it makes sense.
  4. When I click on my All Renewals button it filters all the renewals in the database and puts a button on the end called view details. Then PHP pulls all the details from the database and display the renewal details like below. I then proceed to click update Notes and I get a Text box when it should be showing the current notes in the database "Maintenance contract for firewall support" as well as adding new notes. Both are not working and I spent a whole day on it trying to work it out. This is my Renewals.php file <?php session_start(); include 'Functions/Common_Functions.php'; // Includes menu_items function include 'Functions/functions_renewals.php'; // Includes all renewal button functions include 'Functions/db_con.php'; // Database connection // Display main menu func_header(); menu_items(); // Start the main container echo "<div class='main-container'>"; // Left-side menu echo "<div class='side-menu'>"; echo "<h4 style='color: white; text-align: center;'>Renewals</h4>"; renderRenewalButtons(); echo "</div>"; // Right-side content echo "<div class='right-content'>"; echo "<h2>All Renewals</h2>"; if (isset($_GET['filter']) && $_GET['filter'] === 'allrenewals') { $query = "SELECT * FROM Renewals"; $result = $pdo->query($query); echo "<table class='table table-bordered'>"; echo "<tr> <th>Company Name</th> <th>Service Name</th> <th>Renewal Date</th> <th>Status</th> <th>Notes</th> <th>Action</th> </tr>"; while ($row = $result->fetch(PDO::FETCH_ASSOC)) { echo "<tr>"; echo "<td>" . htmlspecialchars($row['Customer_ID']) . "</td>"; // Replace with actual company name if available echo "<td>" . htmlspecialchars($row['Service_Name']) . "</td>"; echo "<td>" . htmlspecialchars($row['Renewal_Date']) . "</td>"; echo "<td>" . htmlspecialchars($row['Status']) . "</td>"; echo "<td>" . htmlspecialchars($row['Notes']) . "</td>"; echo "<td><button class='view-details-btn' data-id='" . $row['Renewals_ID'] . "'>View Details</button></td>"; echo "</tr>"; } echo "</table>"; } echo "<div id='renewal-details' style='display:none; padding: 20px; border: 1px solid #ddd; margin-top: 20px;'></div>"; echo "</div>"; // End right-side content echo "</div>"; // End main container ?> <!-- ✅ Update Notes Modal --> <div id="updateNotesModal" style="display:none; position:fixed; top:50%; left:50%; transform:translate(-50%, -50%); background:white; padding:20px; border-radius:8px; box-shadow: 0px 4px 6px rgba(0,0,0,0.2);"> <h3>Update Notes</h3> <p id="currentNotesText"></p> <textarea id="newNotesInput" rows="4" style="width:100%;"></textarea> <br><br> <button id="confirmUpdateNotes">Save Notes</button> <button onclick="closeNotesModal()">Cancel</button> </div> <script> document.addEventListener("DOMContentLoaded", function() { console.log("✅ DOM fully loaded and parsed."); // Attach event listeners to all "View Details" buttons document.querySelectorAll(".view-details-btn").forEach(button => { button.addEventListener("click", function() { let renewalId = this.getAttribute("data-id"); console.log("🔄 Fetching details for Renewal ID:", renewalId); fetch("get_renewal_details.php?renewal_id=" + renewalId) .then(response => response.text()) .then(data => { document.getElementById("renewal-details").innerHTML = data; document.getElementById("renewal-details").style.display = "block"; console.log("✅ Renewal details loaded."); // ✅ Reattach event listeners after loading new content setTimeout(attachButtonEvents, 500); }) .catch(error => console.error("❌ Error fetching renewal details:", error)); }); }); }); // ✅ Function to reattach events to dynamically loaded buttons function attachButtonEvents() { console.log("🔄 Reattaching event listeners..."); // Attach "Change Status" button event document.querySelectorAll(".change-status-btn").forEach(button => { button.addEventListener("click", function() { console.log("✅ Change Status button clicked."); openStatusModal(this); }); }); // Attach "Delete" button event document.querySelectorAll(".delete-btn").forEach(button => { button.addEventListener("click", function() { console.log("✅ Delete button clicked."); deleteRenewal(this); }); }); // Attach "Update Notes" button event document.querySelectorAll(".update-notes-btn").forEach(button => { button.addEventListener("click", function() { console.log("✅ Update Notes button clicked."); openNotesModal(this); }); });; } // ✅ Open Change Status Modal function openStatusModal(button) { let currentStatus = button.getAttribute("data-current-status"); let renewalId = button.getAttribute("data-id"); console.log("📢 Opening modal for Renewal ID:", renewalId, "Current Status:", currentStatus); document.getElementById("currentStatusText").innerText = currentStatus; document.getElementById("confirmChangeStatus").setAttribute("data-id", renewalId); document.getElementById("changeStatusModal").style.display = "block"; } // ✅ Close Modal function closeStatusModal() { document.getElementById("changeStatusModal").style.display = "none"; } // ✅ Handle Changing Status (Auto-Refresh) document.addEventListener("click", function(event) { if (event.target.id === "confirmChangeStatus") { let renewalId = event.target.getAttribute("data-id"); let newStatus = document.getElementById("statusDropdown").value; console.log("⏳ Sending status change request..."); fetch("change_status.php?renewal_id=" + renewalId + "&new_status=" + newStatus, { method: "GET" }) .then(response => response.text()) .then(data => { alert("✅ Status Updated: " + data); closeStatusModal(); // ✅ Auto-refresh after status update setTimeout(() => { location.reload(); }, 1000); // Refresh after 1 second }) .catch(error => { alert("❌ Error updating status: " + error); }); } }); // ✅ Delete function function deleteRenewal(button) { let renewalId = button.getAttribute("data-id"); if (confirm("⚠️ Are you sure you want to delete this renewal?")) { console.log("⏳ Deleting renewal..."); fetch("delete_renewal.php?renewal_id=" + renewalId, { method: "GET" }) .then(response => response.text()) .then(data => { alert("✅ Server Response: " + data); document.getElementById("renewal-details").innerHTML = "<p style='color: green;'>Renewal successfully deleted.</p>"; }) .catch(error => { alert("❌ Error deleting renewal: " + error); }); } } // ✅ Open Update Notes Modal function openNotesModal(button) { let renewalId = button.getAttribute("data-id"); let currentNotes = button.getAttribute("data-notes") || "No previous notes."; console.log("📢 Opening Notes Modal for Renewal ID:", renewalId); document.getElementById("currentNotesText").innerText = "Current Notes: " + currentNotes; document.getElementById("newNotesInput").value = ""; // Clear previous input document.getElementById("confirmUpdateNotes").setAttribute("data-id", renewalId); document.getElementById("updateNotesModal").style.display = "block"; } // ✅ Close Notes Modal function closeNotesModal() { document.getElementById("updateNotesModal").style.display = "none"; } // ✅ Handle Updating Notes (Auto-Refresh) document.addEventListener("click", function(event) { if (event.target.id === "confirmUpdateNotes") { let renewalId = event.target.getAttribute("data-id"); let newNotes = document.getElementById("newNotesInput").value.trim(); if (!newNotes) { alert("❌ Please enter new notes."); return; } console.log("⏳ Sending notes update request..."); fetch("update_notes.php?renewal_id=" + renewalId + "&new_notes=" + encodeURIComponent(newNotes), { method: "GET" }) .then(response => response.text()) .then(data => { alert("✅ Notes Updated: " + data); closeNotesModal(); // ✅ Auto-refresh after updating notes setTimeout(() => { location.reload(); }, 1000); // Refresh after 1 second }) .catch(error => { alert("❌ Error updating notes: " + error); }); } }); </script> This is my get_renewal_details.php file <?php include 'Functions/db_con.php'; // Database connection if (!isset($_GET['renewal_id'])) { die("<p style='color: red;'>Error: No Renewal ID received.</p>"); } $renewal_id = intval($_GET['renewal_id']); // Fetch renewal details with JOINs for status name and customer name $stmt = $pdo->prepare(" SELECT r.*, rs.RenewalsStatusName, c.CompanyName FROM Renewals r LEFT JOIN RenewalsStatus rs ON r.Status = rs.RenewalsStatusID LEFT JOIN Customer c ON r.Customer_ID = c.CustomerID WHERE r.Renewals_ID = ? "); $stmt->execute([$renewal_id]); $row = $stmt->fetch(PDO::FETCH_ASSOC); if (!$row) { die("<p style='color: red;'>Error: No details found for Renewal ID: $renewal_id</p>"); } // Display renewal details echo "<h3>Renewal Details</h3>"; echo "<p><strong>Customer:</strong> " . htmlspecialchars($row['CompanyName'] ?? 'Unknown') . "</p>"; echo "<p><strong>Service Name:</strong> " . htmlspecialchars($row['Service_Name']) . "</p>"; echo "<p><strong>Service Type:</strong> " . htmlspecialchars($row['Service_Type']) . "</p>"; echo "<p><strong>Vendor:</strong> " . htmlspecialchars($row['Vendor']) . "</p>"; echo "<p><strong>Contract ID:</strong> " . htmlspecialchars($row['Contract_ID']) . "</p>"; echo "<p><strong>Start Date:</strong> " . htmlspecialchars($row['Start_Date']) . "</p>"; echo "<p><strong>End Date:</strong> " . htmlspecialchars($row['End_Date']) . "</p>"; echo "<p><strong>Renewal Date:</strong> " . htmlspecialchars($row['Renewal_Date']) . "</p>"; echo "<p><strong>Status:</strong> " . htmlspecialchars($row['RenewalsStatusName']) . "</p>"; echo "<p><strong>Recurrence:</strong> " . htmlspecialchars($row['Recurrence']) . "</p>"; echo "<p><strong>Amount:</strong> $" . number_format($row['Amount'], 2) . "</p>"; echo "<p><strong>Alert Days Before:</strong> " . htmlspecialchars($row['Alert_Days_Before']) . " days</p>"; echo "<p><strong>Last Alert Sent:</strong> " . ($row['Last_Alert_Sent'] ? htmlspecialchars($row['Last_Alert_Sent']) : "N/A") . "</p>"; echo "<p><strong>Notes:</strong> " . nl2br(htmlspecialchars($row['Notes'])) . "</p>"; // Buttons echo "<div style='display: flex; justify-content: center; gap: 10px; margin-top: 20px;'> <button class='change-status-btn' data-id='" . (int) $renewal_id . "' data-current-status='" . htmlspecialchars($row['RenewalsStatusName'] ?? '', ENT_QUOTES, 'UTF-8') . "' style='background-color: blue; color: white; padding: 10px; border: none; cursor: pointer;'>Change Status</button> <button class='update-notes-btn' data-id='" . $renewal_id . "' data-notes='" . htmlspecialchars($row['Notes'] ?? '', ENT_QUOTES) . "' style='background-color: green; color: white; padding: 10px; border: none; cursor: pointer;'> Update Notes </button> <p>DEBUG Notes: " . htmlspecialchars($row['Notes'] ?? 'NO NOTES', ENT_QUOTES) . "</p> <!-- Debugging --> <button class='delete-btn' data-id='" . (int) $renewal_id . "' style='background-color: red; color: white; padding: 10px; border: none; cursor: pointer;'>Delete</button> </div>"; // Status Change Modal echo "<div id='changeStatusModal' style='display: none; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: white; padding: 20px; border: 1px solid #ddd; box-shadow: 0px 0px 10px rgba(0,0,0,0.3); z-index: 1000;'> <h3>Change Renewal Status</h3> <p>Current Status: <span id='currentStatusText'></span></p> <label for='statusDropdown'>Select New Status:</label> <select id='statusDropdown'> <option value='1'>Active</option> <option value='2'>Pending</option> <option value='3'>Expired</option> <option value='4'>Renewed</option> <option value='5'>Cancelled</option> </select> <br><br> <button id='confirmChangeStatus' style='background-color: blue; color: white; padding: 10px; border: none; cursor: pointer;'>Change Status</button> <button onclick='closeStatusModal()' style='background-color: gray; color: white; padding: 10px; border: none; cursor: pointer;'>Close</button> </div>"; // Notes Modal echo "<div id='updateNotesModal' style='display: none; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: white; padding: 20px; border: 1px solid #ddd; box-shadow: 0px 0px 10px rgba(0,0,0,0.3); z-index: 1000; width: 400px;'> <h3>Update Renewal Notes</h3> <label for='existingNotes'><strong>Current Notes:</strong></label> <textarea id='existingNotes' readonly style='width: 100%; height: 100px; margin-bottom: 10px; background-color: #f0f0f0;'></textarea> <label for='newNotes'><strong>New Notes:</strong></label> <textarea id='newNotes' style='width: 100%; height: 100px;'></textarea> <br><br> <button id='confirmUpdateNotes' style='background-color: green; color: white; padding: 10px; border: none; cursor: pointer;'>Update</button> <button id='clearNotes' style='background-color: red; color: white; padding: 10px; border: none; cursor: pointer;'>Clear Notes</button> <button onclick='closeNotesModal()' style='background-color: gray; color: white; padding: 10px; border: none; cursor: pointer;'>Close</button> </div>"; ?> <script> document.addEventListener("DOMContentLoaded", function() { console.log("✅ DOM fully loaded and parsed."); // ✅ Open Change Status Modal document.querySelectorAll(".change-status-btn").forEach(button => { button.addEventListener("click", function() { let renewalId = this.getAttribute("data-id"); let currentStatus = this.getAttribute("data-current-status"); document.getElementById("currentStatusText").innerText = currentStatus; document.getElementById("confirmChangeStatus").setAttribute("data-id", renewalId); document.getElementById("changeStatusModal").style.display = "block"; }); }); // ✅ Change Status Action document.getElementById("confirmChangeStatus").addEventListener("click", function() { let renewalId = this.getAttribute("data-id"); let newStatus = document.getElementById("statusDropdown").value; fetch("change_status.php?renewal_id=" + renewalId + "&new_status=" + newStatus, { method: "GET" }) .then(response => response.text()) .then(data => { alert("✅ Status Updated: " + data); closeStatusModal(); setTimeout(() => { location.reload(); }, 1000); }) .catch(error => { alert("❌ Error updating status: " + error); }); }); function closeStatusModal() { document.getElementById("changeStatusModal").style.display = "none"; } // ✅ Open Update Notes Modal document.querySelectorAll(".update-notes-btn").forEach(button => { button.addEventListener("click", function () { let renewalId = this.getAttribute("data-id"); let existingNotes = this.getAttribute("data-notes") || ""; console.log("📝 Opening Update Notes modal..."); console.log("📌 Renewal ID:", renewalId); console.log("📌 Existing Notes Data:", existingNotes); // Debugging // ✅ Ensure "Current Notes" field is found let existingNotesField = document.getElementById("existingNotes"); let newNotesField = document.getElementById("newNotes"); if (!existingNotesField || !newNotesField) { console.error("❌ ERROR: Notes text fields not found in the modal."); return; } // ✅ Directly Assign Notes Value existingNotesField.value = existingNotes; console.log("✅ Assigned Existing Notes to Text Field:", existingNotesField.value); // ✅ Clear the "New Notes" field newNotesField.value = ""; // ✅ Store the renewal ID inside the update button document.getElementById("confirmUpdateNotes").setAttribute("data-id", renewalId); // ✅ Show the modal document.getElementById("updateNotesModal").style.display = "block"; }); }); // ✅ Save Notes Button (Using POST) document.getElementById("confirmUpdateNotes").addEventListener("click", function () { let renewalId = this.getAttribute("data-id"); let newNotes = document.getElementById("newNotes").value.trim(); console.log("🔍 Checking new notes input:", newNotes); if (!renewalId) { alert("❌ Missing renewal ID."); return; } if (!newNotes || newNotes.length === 0) { alert("❌ Please enter new notes."); return; } console.log("🛠 Sending POST request with:", { renewal_id: renewalId, new_notes: newNotes }); fetch("update_notes.php", { method: "POST", headers: { "Content-Type": "application/x-www-form-urlencoded" }, body: "renewal_id=" + encodeURIComponent(renewalId) + "&new_notes=" + encodeURIComponent(newNotes) }) .then(response => response.text()) .then(data => { console.log("✅ Server response:", data); alert("✅ Notes Updated: " + data); closeNotesModal(); setTimeout(() => { location.reload(); }, 1000); }) .catch(error => { alert("❌ Error updating notes: " + error); }); }); function closeNotesModal() { document.getElementById("updateNotesModal").style.display = "none"; } }); </script> and this is my update_notes.php file <?php include 'Functions/db_con.php'; // Database connection if (!isset($_GET['renewal_id']) || !isset($_GET['new_notes'])) { die("Error: Missing renewal ID or new notes."); } $renewal_id = intval($_GET['renewal_id']); $new_notes = trim($_GET['new_notes']); $stmt = $pdo->prepare("UPDATE Renewals SET Notes = ? WHERE Renewals_ID = ?"); if ($stmt->execute([$new_notes, $renewal_id])) { echo "Notes updated successfully."; } else { echo "Error updating notes."; } ?> This is the section of code i think has the issue // ✅ Save Notes Button (Using POST) document.getElementById("confirmUpdateNotes").addEventListener("click", function () { let renewalId = this.getAttribute("data-id"); let newNotes = document.getElementById("newNotes").value.trim(); console.log("🔍 Checking new notes input:", newNotes); if (!renewalId) { alert("❌ Missing renewal ID."); return; } if (!newNotes || newNotes.length === 0) { alert("❌ Please enter new notes."); return; } and this is what comes up when i click update notes So two issues. 1. Current Notes data is not being pulled into text box. 2. not able to update notes in the database Pressing F12 show the following when clicking on update Please go easy on me on by no means a coder.
  5. You have not reponded, so i want to add a second (uri method, in case you are actually trying to load a second page). My example requires an index.html page, a directory named target which contains its own index.html page. index.html at the root: <!DOCTYPE html> <html> <head> <title>CSS :target Practice</title> </head> <body> <h1>CSS :target Practice</h1> <p><a href="target/index.html#tab1">Short Description 1</a></p> <p><a href="target/index.html#tab2">Short Description 2</a></p> </body> </html> index.html in the target directory: <!DOCTYPE html> <html> <head> <title>CSS :target Practice</title> <style> ul.tabs { margin: 0px; padding: 4px; list-style-type: none; font-weight: bold; } .li { padding: 4px; border: solid 1px #ffffff; background: #ffffff; } #tab2content { display: none; } :target { border: solid 1px #009900; background: #e0e0e0; } #tab2:target { font-size: 24pt; } #tab2:target > #tab2content { display: block; } </style> </head> <body> <h1>CSS :target Practice</h1> <p>The target will be active per css (working in modern browsers: Edge/Chrome, Firefox, Opera and Safari)</p> <ul class="tabs"> <li id="tab1">!Product Enquiry</li> <li id="tab2">Product Enquiry <ul id="tab2content"><li>Hello Product seeker</li></ul></li> </ul> </body> </html> Perhaps you can let us know if you figured it out or not, John
  6. Just a word of warning - get out of the habit of prefixing numeric values with leading zeroes. That tells PHP that the value is Octal, not Decimal. Try running any PHP code using the "numbers" 08 or 09! https://www.php.net/manual/en/language.types.integer.php "To use octal notation, precede the number with a 0 (zero). As of PHP 8.1.0, octal notation can also be preceded with 0o or 0O." Regards, Phill W.
  7. Last week
  8. the php error you are getting is a follow-on error, because the query is failing, but there is no error handling for the query. the easiest way of adding error handling for all the mysqli statements that can fail - connection, query, exec, prepare, and execute, is to use exceptions for errors (this is the default setting now in php8+). to enabled exceptions for the mysqli extension, add the following line of code before the point where you make the database connection (or upgrade to php8) - mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); you should then be getting an uncaught exception error with the raw database error information in it about a non-groupby/non-aggerate column being referenced. the correct way of fixing this is to a) only select the columns you are using, and b) every column you are selecting needs to be either in the GROUP BY term or used in an aggerate function. there is a database server mode setting that control if this condition produces a query error (the current setting) or if it is just a warning. you may or may not have access to this database mode setting.
  9. Xenforo is a message board platform. It has a guided installation process for those who need it, but I was going through it because I wanted a clean install. The prevailing thought is it's a server permission issue, but my host support hasn't been responsive.
  10. That's fair. I was mostly wondering if anyone else had had this issue.
  11. Up until a week ago the below worked just fine. I migrated my site to a new server space, and now the below is throwing an error. When I remove the GROUP BY, the error goes away. I marked the line throwing the error. $query="SELECT *, e.id as eid,event FROM a_events e INNER JOIN a_players_reviews pr ON pr.eventID = e.id WHERE date_format(start, '%y') = '". $current_season ."' GROUP BY event ORDER BY start desc "; echo '<div class="events_header"><h3>Events & Tournaments</h3></div>'; echo '<div class="events_list">'; $results = mysqli_query($con,$query); LINE 1088 while($line = mysqli_fetch_assoc($results)) { Thank you
  12. Thank you! I'll do some more work on it.
  13. the syntax error(s) are due to missing quotes on the end of each string and reusing the same type of quote inside the strings. you are building and echoing literal strings. the initial and final quotes on each string must be the same type and be a matching pair. you are missing the final quote on each string. the > at the end are part the <img ... > tag and belong inside the string, e.g. echo "<img ...>";. any quotes that are within a string must either be the 'opposite' type, single vs double, or they must be escaped so that they don't match the initial quote, which terminates the string. the initial and final quotes around the src="..." attribute should either be changed to single-quotes or escaped with \ characters. i prefer less typing, so i would use single-quotes. next, your conditional logic only needs - if( normal case){ echo normal output } else { echo special output }. lastly, your conditional comparisons need some help. you need to test if the 'm' and 'd' part of the date is greater than or equal a lower value AND less then or equal to a higher value. also, for testing purposes, you need to be able to manually set the value being tested, so this value should be built in a variable, which will be a string, e.g. '0106' for jan 6th. as long as the fields making up a string are the same width, and from left to right, most significant to least significant, you can directly compare strings, e.g. if('0106' <= $some_variable ... i'll let you cogitate on how to create and test the conditional logic needed.
  14. Hi all, I hope you can help. I am trying to write php code so that a different image is displayed in my site header depending on the date. All year round is one image, but at Christmas a festive version is shown instead. Here is my code; <?php // Normal (6 Jan - 31 Nov) if ((date('m') == 06) && (date('d') >= 01) || (date('m') == 11) && (date('d') <= 31)) { echo "<img src="image/site/site-header.png">; } // Christmas (1 Dec-5 Jan) else if ((date('m') == 12) && (date('d') == 01)) || (date('m') == 01) && (date('d') <= 05)) { echo "<img src="image/site/site-header-christmas.png">; } ?> However, I am getting this error message; Parse error: syntax error, unexpected 'image' (T_STRING), expecting ';' or ',' in /homepages/29/d1007800584/htdocs/page/site-header-test.php on line 4 Sorry, I am very much a beginner so please forgive my ignorance / stupidity - what am I doing wrong here?
  15. Thank you, thank you, thank you all so much! That was it! Phew! I'll ask my host about the outdated php.
  16. /homepages/29/d1007800584/htdocs is your site root - this is set by your host at the server level. If site-header.php and tester-include.php are both in the /page/ directory, the include from tester-include.php should be simply `require_once('./site-header.php');` If that still doesn't work, try `require_once(dirname(__FILE__).'/site-header.php');` (if site-header.php is in a sub-directory called /root/, add that into the require). As an aside, your host should be on php 8.1 at the least - 7.4 reached end of life in November 2022. You may want to ask them why they haven't upgraded yet. If they can't give you a decent answer, there are plenty of low-cost modern hosts around - ask here. Someone can point you in the right direction.
  17. target has plenty of documentation, so you shouldn't have a problem implementing it into your code. I do not use wordpress stuff and i cannot help you with that code but here is a sample of target practice and you should be able to work it into your project regardless of the method (css or js/css etc). <!DOCTYPE html> <html> <head> <title>CSS :target Practice</title> <style> ul.tabs { margin: 0px; padding: 4px; list-style-type: none; font-weight: bold; } .li { padding: 4px; border: solid 1px #ffffff; background: #ffffff; } #tab2content { display: none; } :target { border: solid 1px #009900; background: #e0e0e0; } #tab2:target { font-size: 24pt; } #tab2:target > #tab2content { display: block; } </style> </head> <body> <h1>CSS :target Practice</h1> <p><a href="#tab1">Short Description 1</a></p> <p><a href="#tab2">Short Description 2</a></p> <p>...</p> <ul class="tabs"> <li id="tab1">!Product Enquiry</li> <li id="tab2">Product Enquiry <ul id="tab2content"><li>Hello Product seeker</li></ul></li> </ul> </body> </html> https://www.w3.org/Style/Examples/007/target.en.html https://developer.mozilla.org/de/docs/Web/CSS/:target I hope that this is helpful, John
  18. We have a selection of tabs from a default Woocommerce website. The owner wants a button in the Short Description, than when clicked, takes the user down to the row of tabs (Description etc)... but SELECTS the "Product Enquiry" tab (which does have it's own #id). I've seen a few :target CSS methods, but don't understand. Can you please help?
  19. From the looks of it, you are simply unclear on how PHP arrays work, and the syntax involved. PHP arrays are highly versatile, in that they combine what in many other languages, requires multiple different data structure types. It is a combination of an Array, a List and a Map, if we were going back to the standard library of C++. Maps are probably the most interesting, in that a map is a structure that has a 'key' = 'value' association. This is different from an array, which is simply a data structure of 1-N elements, indexed numerically. In c and c++ arrays are limited to a data type. Due to strict typing requirements in c and c++ (and other similar "strongly typed") languages, you are constrained in how you assemble, add to and modify an array, but PHP is extremely flexible in essentially letting you store data type or object as a value in an array, and allowing you to nest arrays within arrays any way that suits you. In your example, you presented a series of nested arrays, some being traditionally numeric, and others containing one or more "key/value" elements. The curious thing is that the array you presented is invalid. Notice that your syrup values are missing the => required to define a key/value element. $arr = [ 0 => ["meds" => [ "IV" => 1, "pill" => 2, "syrup" = 3] ], 1 => ["meds" => [ "IV" => 2, "pill" => 4, "syrup" = 6] ], 2 => ["meds" => [ "IV" => 5, "pill" => 5, "syrup" = 5] ] ]; I fixed that for the following example code. Rather than defining this in one shot, consider how you could start with an empty array and arrive at the same structure. <?php function printArr($a, $name='') { echo "$name --------------------------\n\n"; print_r($a); echo PHP_EOL; } $arr = [ 0 => ["meds" => [ "IV" => 1, "pill" => 2, "syrup" => 3] ], 1 => ["meds" => [ "IV" => 2, "pill" => 4, "syrup" => 6] ], 2 => ["meds" => [ "IV" => 5, "pill" => 5, "syrup" => 5] ] ]; printArr($arr, 'Original Array'); // Empty $arr2 = []; printArr($arr2, 'Rebuilt Array'); $arr2[0] = []; printArr($arr2); $arr2[0]['meds'] = []; printArr($arr2); $arr2[0]['meds']['IV'] = 1; printArr($arr2); $arr2[0]['meds']['pill'] = 2; printArr($arr2); $arr2[0]['meds']['syrup'] = 3; printArr($arr2); // Add a new empty array to 1st dimenion of array. This will become $arr2[1] $arr2[] = []; printArr($arr2, '1st Dimension, new index 1. Arrays are zero based'); // Assign value to be new array with key "meds" having a value of an empty array. $arr2[1]['meds'] = []; printArr($arr2); // Set the value of this nested array element to be a nested array $arr2[1]['meds'] = [ "IV" => 2, "pill" => 4, "syrup" => 6]; printArr($arr2); //Set entire element 3 structure in one assignment $arr2[] = ['meds' => [ "IV" => 5, "pill" => 5, "syrup" => 5]]; printArr($arr2, 'Array complete'); echo "Comparisons ---------------------\n"; echo $arr[0]['meds']['pill'] . PHP_EOL; echo $arr2[0]['meds']['pill'] . PHP_EOL; echo "\n\n"; foreach($arr[2]['meds'] as $nestedKey => $nestedVal) { echo "$nestedKey = $nestedVal\n"; } echo "\n\n"; foreach($arr2[2]['meds'] as $nestedKey => $nestedVal) { echo "$nestedKey = $nestedVal\n"; } The Results: Original Array -------------------------- Array ( [0] => Array ( [meds] => Array ( [IV] => 1 [pill] => 2 [syrup] => 3 ) ) [1] => Array ( [meds] => Array ( [IV] => 2 [pill] => 4 [syrup] => 6 ) ) [2] => Array ( [meds] => Array ( [IV] => 5 [pill] => 5 [syrup] => 5 ) ) ) Rebuilt Array -------------------------- Array ( ) -------------------------- Array ( [0] => Array ( ) ) -------------------------- Array ( [0] => Array ( [meds] => Array ( ) ) ) -------------------------- Array ( [0] => Array ( [meds] => Array ( [IV] => 1 ) ) ) -------------------------- Array ( [0] => Array ( [meds] => Array ( [IV] => 1 [pill] => 2 ) ) ) -------------------------- Array ( [0] => Array ( [meds] => Array ( [IV] => 1 [pill] => 2 [syrup] => 3 ) ) ) 1st Dimension, new index 1. Arrays are zero based -------------------------- Array ( [0] => Array ( [meds] => Array ( [IV] => 1 [pill] => 2 [syrup] => 3 ) ) [1] => Array ( ) ) -------------------------- Array ( [0] => Array ( [meds] => Array ( [IV] => 1 [pill] => 2 [syrup] => 3 ) ) [1] => Array ( [meds] => Array ( ) ) ) -------------------------- Array ( [0] => Array ( [meds] => Array ( [IV] => 1 [pill] => 2 [syrup] => 3 ) ) [1] => Array ( [meds] => Array ( [IV] => 2 [pill] => 4 [syrup] => 6 ) ) ) Array complete -------------------------- Array ( [0] => Array ( [meds] => Array ( [IV] => 1 [pill] => 2 [syrup] => 3 ) ) [1] => Array ( [meds] => Array ( [IV] => 2 [pill] => 4 [syrup] => 6 ) ) [2] => Array ( [meds] => Array ( [IV] => 5 [pill] => 5 [syrup] => 5 ) ) ) Comparisons --------------------- 2 2 IV = 5 pill = 5 syrup = 5 IV = 5 pill = 5 syrup = 5 If you can look at these results and understand them, you'll have a better idea of how to reference any element in a nested array directly. You can also reference any dimension, going from left to right, where the first Dimension (array) will be $r[], the 2nd dimension $r[][] and so on, for as many nested dimensions as you might have.
  20. First an editorial comment: Please do not take screen shots of code for your questions. We can't use that in our replies or help. We have a code block for a reason. You can easily copy/paste snippets of relative code into the code block, and that makes it possible for us to make edits based on the original code. Nobody here likes having to re-type parts of your code. Paths in your html are relative to the document root. The document root is a function of the web server configuration for the server or vhost you have configured. The types of things you can refer to in an html script are only things that the server understands to have an associated URL. In other words, they are things that you could use a url to access directly from your website. PHP works entirely with files, and file system paths on your workstation. Using PHP code to open include/require files always requires a file system path. When you include a file, the "working directory" for PHP is the path/location in the server file system where the script exists. So to include a php script from another php script you have 2 options: Provide the fully qualified path to the script. Because this path is operating system dependent, you typically don't want to do this as it requires you to add configuration in a file or even edit your source code purely because you moved servers. A Relative Path This is relative, again to the directory where the script that is including this code is. Relative paths can utilize 2 "special files": "." is the current directory. ".." is the parent directory. We don't know what the file system layout is for your project, so we can only guess at the correct path relative to the index.php? or whatever file it is that you are trying to do this php include in is named. If this directory has a sub-directory named "page" and you have put the site-header.php script into that directory, then the relative path you want to use will be: include("page/site-header.php"); This is how you specify a subdirectory path relatively. If you include a leading "/" that is considered the "root" directory of the filesystem. One other thing you might want to do is change include to require_once(). With a require_once() the script will actually error out rather than continue to run along without regard to the fact that your include failed.
  21. We don't have enough information to really help you here. Looking into xenforo, I see that it is a commercial product, with a self host license of $195, and no open source version. Without the source people really can't do any debugging for you. My advice would be to contact the company directly as this is some sort of installation issue, and they are really the only ones in a position to understand the implications of that stack trace.
  22. the file system path/filename must be to where the file is located on the disk, either using a relative path (relative to the file with the include/require starting in it) or an absolute path. a leading / refers to the root of the current disk, which is doubtful where that file is located, and which will be producing a php error about a non-existent path/file. you must get php to help you by reporting and displaying all the errors it detects. you can temporarily set php's error_reporting/display_errors in your code (you will want to remove the settings when you are done learning, developing, and debugging). you can add the following immediately after the first opening <?php tag in the main file - ini_set('display_errors', '1'); error_reporting(-1);
  23. it would be nice to know what you do and what the software does concerning database creation, database user creation, and database user permissions. do you create the database, the database user, and assign permissions, then enter the connection information into the configuration file? are any tables being created in that database? are there any other similarly named databases that if they for example stripped out non-ascii characters could match the desired database name? what i suspect is there is more than one database, that they then get switch somewhere in the process so that at the point where the query in question is executed it's not using the correct database or that the table creation fails due to a permission issue and there's no error handling and/or no reporting of the failed table creation queries.
  24. I'm sure of the nitoaute_csi part. nitoaute_ is what is assigned to me. I appended the csi part. I'm using HostGator, shared hosting, and in the past their support ticket has been very good. However, it's been awhile since I've had an issue on this side of things since I changed server spaces. This is just taking too long. Part of that is my fault for getting help via chat. Luckily it's not a production site, but the Users of this forum are a small but vocal group (of freeloaders). 🙂 Meanwhile, I have also installed other platforms on this server space since starting it up. This issue is the only one I'm having. I was hoping someone else had come across it and can direct to which questions to ask, or even if there is something I add to htaccess.
  25. a bunch of points - three ... in a relative file system path is invalid. you should be learning, developing, and debugging code on a localhost development system, such xampp. do you have php's error_reporting set to E_ALL and display_errors set to ON, preferably in the php.ini on your development system, so that php will help you by reporting and displaying all the errors it detects? is the main page a .php page? what does the 'view source' of the resulting web page show in the browser? you should use 'require' for things your code must have. your goal is to produce ONE valid web page. the file that you require is not a complete web page, it is only the code/content that you want to be required at that point in the web page. you need to validate the resulting web pages at validator.w3.org all the navigation links you have shown are all the same. you should be dynamically building the web pages using a Content Management System (CMS), in which case the navigation links would be dynamically built too, based on the defined pages, instead of manually creating and managing a bunch of pages yourself.
  1. Load more activity
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.