Jump to content

LeonLatex

Members
  • Posts

    393
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by LeonLatex

  1. @maxxd@Strider64 Of course, I do. I don't save a plain-text password in the database Have you read through the thread, you would see that your question is so unnecessary, or am I wrong? The password is saved to the "password_hash" column in db, and id hashed with this: <?php $password = '******'; // Replace the stars with the actual password $hashed_password = password_hash($password, PASSWORD_DEFAULT); echo $hashed_password; // This will output the hashed version of the password for you. Just copy and paste ?>
  2. @mac_gyver, If you look in bottom of my first posting you find my login form. I dont have a registration form yet because so early in the development process i manually put the testing user accounts in mysql manually. I dont have time to use more time on this now, so i will start develop another system, and this time with email confirmation and a confirmation code. Is less use of time to put a new one together than looking for errors in this login system. I dont think there is only one error. The system has going through many changes through the last year, so it's time to let the old one rest. Any way, thanks for using time for trying to help 😃
  3. One of the first things I did was go through the password and username. I checked the db-connection with this one too: <?php $servername = "***.****.********.no"; $username = "*****_*****"; $password = "************"; $database = "*****_*****"; try { $pdo = new PDO("mysql:host=$servername;dbname=$database", $username, $password); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); echo "Connection successful!"; } catch(PDOException $e) { echo "Error connecting: " . $e->getMessage(); } ?> Then I checked if the hashed password was corect and matched. As a precaution, I set up a new hashed password string using this code, and paste it into the database table users: <?php $password = '******'; // Replace this with the actual password $hashed_password = password_hash($password, PASSWORD_DEFAULT); echo $hashed_password; // This will output the hashed version of the password ?>
  4. Sorry again. There's a little busy here today (every day). The problem is that i get the $error_message = "Feil e-postadresse eller passord."; ...and I dont know why. It has been running fine on another site, but not on this site I am dealing with now. The only difference is the database. I cant find any there. Can you ?
  5. Of course Requinix. Here is that part: <?php // Inkluder skriptet for databasekobling. include_once $_SERVER['DOCUMENT_ROOT'] . '/includes/db.php'; if ($_SERVER['REQUEST_METHOD'] === 'POST') { // Hent brukerregistreringsdata fra skjemaet. $first_name = $_POST['first_name']; $last_name = $_POST['last_name']; $email = $_POST['email']; $password = $_POST['password']; // Dette skal være passordet i klartekst som brukeren oppgir. // Hash brukerens passord før det lagres i databasen. $hashed_password = password_hash($password, PASSWORD_DEFAULT); // SQL-spørring for å sette inn brukeren i databasen. $sql = "INSERT INTO users (first_name, last_name, email, password_hash) VALUES (:first_name, :last_name, :email, :password_hash)"; // Forbered og utfør SQL-setningen. $stmt = $pdo->prepare($sql); $stmt->bindParam(':first_name', $first_name); $stmt->bindParam(':last_name', $last_name); $stmt->bindParam(':email', $email); $stmt->bindParam(':password_hash', $hashed_password); if ($stmt->execute()) { // Brukerregistrering vellykket. echo "Bruker registrert vellykket!"; // Du kan omdirigere brukeren til en påloggingsside eller vise en suksessmelding. } else { // Brukerregistrering mislyktes. echo "Brukerregistrering mislyktes. Prøv igjen senere."; } } ?>
  6. I was setting up a login system that was working till I want it to hash the password. I paste both my user table in the database and login.php. I can't find what's wrong, can you? <?php // Inkluder databasekobling og nødvendige funksjoner include_once $_SERVER['DOCUMENT_ROOT'] . '/includes/db.php'; if ($_SERVER['REQUEST_METHOD'] === 'POST') { // Håndter innloggingsskjemaet som er sendt inn. $email = $_POST['email']; $password = $_POST['password']; // Hent brukerens hashed passord fra databasen basert på e-postadressen $sql = "SELECT * FROM users WHERE email = :email"; $stmt = $pdo->prepare($sql); $stmt->bindParam(':email', $email); $stmt->execute(); $user = $stmt->fetch(); if ($user && password_verify($password, $user['password_hash'])) { // Passordet er gyldig, opprett en brukersesjon session_start(); $_SESSION['user_id'] = $user['user_id']; $_SESSION['user_role'] = $user['role']; // Gi tilbakemelding til brukeren om vellykket innlogging header('Location: dashboard.php'); // Omdiriger til en beskyttet side exit(); } else { // Feil passord, gi tilbakemelding om innloggingsfeil $error_message = "Feil e-postadresse eller passord."; } } ?> <!DOCTYPE html> <html lang="en"> <head> <!-- ... Legg til nødvendige meta-informasjon og stiler ... --> </head> <body> <h2>Logg inn</h2> <?php if (isset($error_message)): ?> <p><?php echo $error_message; ?></p> <?php endif; ?> <form method="post" action="login.php"> <label for="email">E-postadresse:</label> <input type="email" id="email" name="email" required> <label for="password">Passord:</label> <input type="password" id="password" name="password" required> <input type="submit" value="Logg inn"> </form> </body> </html> /* Navicat MySQL Data Transfer SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for users -- ---------------------------- DROP TABLE IF EXISTS `users`; CREATE TABLE `users` ( `user_id` int(11) NOT NULL AUTO_INCREMENT, `first_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `middle_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `last_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `city` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `postal_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `birthday` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `country` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `county` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `municipality` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `phone` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `sex` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `display_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `password_hash` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `confirm_password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `confirm_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `role` enum('user','moderator','administrator') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'user', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`user_id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 17 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of users -- ---------------------------- SET FOREIGN_KEY_CHECKS = 1;
  7. requinix, the problem is that the username/email does not match the specified size in the CSS document. The password field does, but not the username field. I know that this is probably a trivial issue, but I can't seem to spot the triviality. There might be an extra letter or one missing altogether.
  8. I am working on a new project, and I have a problem with CSS and the size of a text box for username/email. I want the box to change size like the password box, because that one works, but not the box for username/email. I am pasting the HTML and CSS below. Thank you for all your help. <form method="POST" action="login_process.php"> <div class="login_div"> <input type="text" name="email" placeholder="Email" required> <input type="password" name="password" placeholder="Passord" required> <label for="showPassword">Vis passord</label><input type="checkbox" id="showPassword"><p> <button type="submit">Login</button> </div> </form> <script> document.getElementById("showPassword").addEventListener("change", function () { var passwordInput = document.querySelector("input[name='password']"); if (passwordInput.type === "password") { passwordInput.type = "text"; } else { passwordInput.type = "password"; } }); </script> /* CSS Document */ /* styles.css */ body { font-family: Arial, sans-serif; background-color: #ffffff; margin: 0; padding: 0; } h2 { color: #333; } form { width: 300px; margin: 0 auto; padding: 20px; background-color: #fff; border-radius: 5px; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); } label { display: block; margin-bottom: 5px; font-size: 11px; font-weight: normal; } input[type="email"], input[type="password"] { width: 30%; padding: 2px; margin-bottom: 0px; border-radius: 5px solid thin #000; font-size: 14px; } input[type="submit"] { display: block; width: 10%; padding: 10px; background-color: #333; color: #fff; border:thin; border-radius: 5px; font-size: 14px; cursor: pointer; } input[type="submit"]:hover { background-color: #fff; }
  9. No, but I fixed it now. I set the charset to utf8mb4. Thanks Barand.
  10. Barand, i cant make it work wit Æ, Ø or Å. They won't save to the database. All other letters is saved in the database. Is the problem in the hashing of the password?
  11. I have set up this block for validating password reg. // Validering av passord if (strlen($password) < 8 || !preg_match("/[A-Z]/", $password) || !preg_match("/[0-9]/", $password)) { $error_message = "Passordet må være minst 8 tegn langt, inneholde minst én stor bokstav og ett tall."; // Legg til en feilmelding i en feilmeldingsarray for å vise senere. In can't make it work with Scandinavian special letters Ææ, Øø, Åå Does someone here know how to fix this?
  12. I am trying to follow this guide on how to configure GitHub Copilot in Visual Studio Code. That goes well till I come to number three. Where is that login button in the left corner? How does it look? -------------------- To configure Github Copilot in Visual Studio Code, you need to follow these steps: 1- Install Visual Studio Code: If you haven't already, you can download and install Visual Studio Code from the official website: https://code.visualstudio.com/. 2- Install the Github Copilot extension: Open Visual Studio Code and click on the "Extensions" icon in the left-hand sidebar. Search for "Github Copilot" and install the official extension that is developed by Github and Microsoft. 3- Sign in to Github: After installing the extension, click on the "Sign in to GitHub" button in the bottom left corner of the Visual Studio Code window, and follow the instructions to sign in to your Github account. 4- Activate Github Copilot: Once you are signed in to Github, you can activate Github Copilot by opening a file and typing some code. Press "Ctrl+Space" (Windows, Linux) or "Cmd+Space" (Mac) to trigger Github Copilot, and it will start suggesting code for you. 5- Customize the settings: You can customize the settings for Github Copilot by going to the Visual Studio Code settings (File > Preferences > Settings), searching for "Github Copilot", and adjusting the relevant settings to your preference. 6- That's it! You should now be able to use Github Copilot in Visual Studio Code. Just remember that Github Copilot is an AI-powered code generator that uses machine learning to suggest code based on context, and it is not a complete replacement for manual coding. You should always review and understand the code generated by Github Copilot before using it in production environments.
  13. I have asked about this in another project before, but now the problem is back. I am still struggling with this. Read through my CSS, and look at my HTML, I can't understand this no matter how hard I try, over and over again. My screen resolution is 1920X1080. In that resolution, the site looks as I want. It's only the header and the menu bar whos not cooperating. For those of you who want to see this problem in action and, what's happening and what's not happening, here is the link to the site: www.matsnakk.com This is the one who's making all the trouble, but i need it for scaling my header banner background image: background: url("../../images/matsnakk_header.png") no-repeat; background-size: contain; /*Makes the background scaling.*/ <?php error_reporting(E_ALL); ini_set('display_errors', 1); include $_SERVER['DOCUMENT_ROOT'] . '/includes/db.php'; ?> <!doctype html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title><?php echo $article['title_tag']; ?></title> <link rel='stylesheet' href='https://www.w3schools.com/w3css/4/w3.css'> <link rel="stylesheet" href="<?php echo BASE_URL; ?>scripts/css/style.css" rel="stylesheet" type="text/css"> <link rel="stylesheet" href="<?php echo BASE_URL; ?>scripts/css/navbar.css" rel="stylesheet" type="text/css"> <link rel="stylesheet" href="<?php echo BASE_URL; ?>scripts/css/header.css" rel="stylesheet" type="text/css"> <link rel="stylesheet" href="<?php echo BASE_URL; ?>scripts/css/main.css" rel="stylesheet" type="text/css"> <link rel="stylesheet" href="<?php echo BASE_URL; ?>scripts/css/footer.css" rel="stylesheet" type="text/css"> <link rel="stylesheet" href="<?php echo BASE_URL; ?>scripts/css/main_elements.css" rel="stylesheet" type="text/css"> </head> <body class="body"> <div class="banner"></div> <div class="menu_div"> <a href='<?=$HOST?>index.php'class='w3-bar-item w3-button color: white w3-round-tiny w3-hover-white'>Hjem</a> <a href='<?=$HOST?>recipes.php'class='w3-bar-item w3-button w3-round-tiny w3-hover-white'>Oppskrifter</a> <a href='<?=$HOST?>restaurants.php'class='w3-bar-item w3-button w3-round-tiny w3-hover-white'>Restauranter</a> <a href='<?=$HOST?>recipes.php'class='w3-bar-item w3-button w3-round-tiny w3-hover-white'>Café - Diners</a> <a href='<?=$HOST?>roadside.php'class='w3-bar-item w3-button w3-round-tiny w3-hover-white'>Etter veien</a> <a href='<?=$HOST?>fastfood.php'class='w3-bar-item w3-button w3-round-tiny w3-hover-white'>Fastfood</a> <a href='<?=$HOST?>forums.php'class='w3-bar-item w3-button w3-round-tiny w3-hover-white'>Diskuter</a> <a href='<?=$HOST?>news.php'class='w3-bar-item w3-button w3-round-tiny w3-hover-white'>Nyheter</a> <a href='<?=$HOST?>about.php'class='w3-bar-item w3-button w3-round-tiny w3-hover-white'>Om Matsnakk</a> </div></div> <div class="main_bg"> </div> <div class="footer_bg"> <br> <div class="footer"> Matsnakk &copy;<br> All Rights Reserved. </div> </footer> </body> </html> /* CSS Document */ div.logo_bg { width: 250px; height: 69px; margin-left: 28px; margin-top: 0px; margin-bottom: 0px; margin-right: 0px; padding-top: 0px; padding-left: 10px; } div.container { background-color: #f7f7f7; display: flex; position: fixed; box-sizing: border-box; overflow: hidden; height: 100%; width: 100%; top: 0px; left: 0px; } body.style { background-color: #f7f7f7; font-family: "Verdana, Consolas", "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", "DejaVu Sans", "sans-serif"; padding-top: 0PX; margin-top: 0px; } div.banner { background-color: #033333; background: url("../../images/matsnakk_header.png") no-repeat; background-size: contain; /*Makes the background scaling.*/ width: 100%; height: 250px; position: fixed; } /*div.logo_div { background-image: url("../../images/matsnakk_logo_liten.png"); flex: 1; position: fixed; box-sizing: border-box; height: 69px; width: 250px; top: 11px; left: 30px; }*/ div.menu_bar { background-color: #033333; position: fixed; box-sizing: border-box; overflow: hidden; font-size: 15px; font-weight: bold; margin-top: 0px; height: 25px; width: 100%; top: 0px; left: 0px; } div.menu_div { display: flex; justify-content: center; margin-top: 10px; background-color: #f7f7f7; position: fixed; box-sizing: border-box; overflow: hidden; height: 35px; width: 100%; top: 240px; left: 0px; border-bottom: 2px solid #033333; }
  14. I can't figure this puzzle out. I have tried most things throughout the night, but I have not set up this DIV as either a FLEX CONTAINER or a GRID CONTAINER. So, I tried to do that too, but it wasn't working. Do I have to place it in some special place in the CSS code? So, what will work here to align the text and content in this menu bar in center position? Everything is on one line too. I would appreciate it if someone could show me where to put it? <body class="body"> <div class="menu_div">Menu items</div> div.menu_div { margin-top: 10px; background-color: #ffffff; position: fixed; box-sizing: border-box; overflow: hidden; height: 35px; width: 100%; top: 83px; left: 0px; border-bottom: thin solid #033333; }
  15. I found the solution my self. - I had to remove the hight on big_div and change it to min-height. - Set the position property of .nav_div to absolute, and position it at the bottom of .big_div. - And I had to remove this line: background-size: contain; /*Makes the background scaling.* Both .big_div and .nav_div is scaling in proportion to the background image in .big_div, and .nav_div stays at the bottom of .big_div when it scales. Case closed.
  16. If you suspect that someone is sending spam to you through means other than your website's contact form, there are several things you can do to investigate: Check the email headers: Email headers contain information about the sender, including the IP address and the originating server. You can use an email header analyzer tool to decode the headers and check if the email was sent from your website's server or from a different one. Verify the sender's email address: Check the sender's email address to see if it matches the email address used on your website's contact form. If the email address is different, it is likely that the email was sent from a different source. Use CAPTCHA: Implement a CAPTCHA on your website's contact form to prevent automated spam bots from submitting the form. Implement email authentication protocols: Implement email authentication protocols such as SPF, DKIM, and DMARC to verify that emails sent from your domain are legitimate. Monitor your website's traffic: Use website analytics tools to monitor your website's traffic and look for unusual spikes in traffic or suspicious activity. By taking these steps, you can help ensure that the emails you receive through your website's contact form are legitimate and have been sent from your website's server.
  17. It is the background image that is scaling, but the two div's is not. I have removed the img_div so I have just big_div and nav_div left. I thought that maybe this would help. I discovered that it is not the nav_div that is not scaling when I minimize the browser window. It doesn't follow the background picture with the logo and graphic. Because the background picture is scaling as it should. The problem occurs when I minimize the browser window, and the two div's are not scaling like the background image. The background image is scaling because of this one: background: url("../images/topbg.png") no-repeat; background-size: contain; /*Makes the background scaling.*/ First (like in my first posting) I thought that the nav bar was hanging on the same place and the other two div's was scaling. But that wasn't the problem. The problem occurs when the background image is scaling, but the div's is not. How to make this work I don't have a clue, but I hope someone here has and can help. Please, tell me how to solve this problem. I hope this is enough information when I include the screenshots 😊 The CSS is the same as in my opening posting minus the img_div and I also corrected the quoting that was missing👍 Maximized Minimized CSS: .big_div { margin: auto; width: 100%; height: 203px; padding-top: 0px; padding-left: 0px; padding-right: 0px; font-size: 14pt; background: url("../images/topbg.png") no-repeat; background-size: contain; /*Makes the background scaling.*/ } .nav_div { background-color: #ff0000; margin: auto; width: 100%; height: 40px; padding-top: 0px; padding-left: 0px; padding-right: 0px; font-size: 13pt; text-align: center; vertical-align: middle; } HTML: <div class="big_div"></div> <div class="nav_div"> <a id="nav-hjem" href="<?=$HOST?>index.php" class="w3-bar-item w3-button">Hjem</a> <a id="nav-jeg" href="<?=$HOST?>index.php" class="w3-bar-item w3-button">Jeg</a> <a id="nav-meg" href="<?=$HOST?>index.php" class="w3-bar-item w3-button">Meg</a> <a id="nav-deg" href="<?=$HOST?>index.php" class="w3-bar-item w3-button">Deg</a> <a id="nav-du" href="<?=$HOST?>index.php" class="w3-bar-item w3-button">Du</a> </div>
  18. Hello senenglari, the earth is answering 😉
  19. nav_div remains in the same place when I minimize and scale. It should follow the div above, but doesn't. The width and height scale, but it does not move accordingly. What and where is wrong? CSS: .big_div { margin: auto; width: 100%; height: 201px; padding-top: 0px; padding-left: 0px; padding-right: 0px; font-size: 14pt; } .img_div { width: 100%; height: 203px; background: url("../images/logo.png") no-repeat; background-size: contain; } .nav_div { background-color: #ff0000; margin: auto; width: 100%; height: 40px; padding-top: 0px; padding-left: 0px; padding-right: 0px; font-size: 13pt; text-align: center; vertical-align: middle; } HTML: <div class="big_div"><div class="img_div"></div></div> <div class="nav_div"> <a id='nav-hjem' href='<?=$HOST?>index.php' class='w3-bar-item w3-button'>Hjem</a> <a id='nav-jeg' href='<?=$HOST?>index.php' class='w3-bar-item w3-button'>Jeg</a> <a id='nav-meg' href='<?=$HOST?>index.php' class='w3-bar-item w3-button'>Meg</a> <a id='nav-deg href='<?=$HOST?>index.php' class='w3-bar-item w3-button'>Deg</a> <a id='nav-du' href='<?=$HOST?>index.php' class='w3-bar-item w3-button'>Du</a> </div>
  20. Thanks for the answer to both of you. I tried as Requinix said to print out the path and found out the difference between those two.
  21. I have put the PDO database connection one level above (outside) the WWW directory on the server to protect it from unwanted visitors who get hold of the user data of the database server. Today I use this in other places than where it says now, but it is only as an example: include __DIR__ . '/../includes/db.php'; but then I thought of the super global $server , but I can't get it to work. I have set it up like this: include($_SERVER['DOCUMENT_ROOT'] . "../includes/db.php"); What am I doing wrong? Or won't it work with the super global example? And how do I create a variable out of the super global string so I only use $linkpath in front of the path to the file I want to link to?
  22. What do you call the small articles that are placed as samples or click bait on the front page. That is, e.g. a picture of the main picture in the article + a small extract of the text in the news article. What are these called in English, is it the same as thumbnail?
  23. I used an hour on this. I am not so good at this, so I had to use some extra minutes on it. Hope I am right and you understand it. To edit a database entry using the id, you need to retrieve the id of the record to be edited, and then update the corresponding fields in the database with the new values. Here are the changes you can make to the existing code to enable editing of the database entry using the id: Update the form action to point to the PHP file that will handle the form submission, and pass the id of the record to be edited as a query parameter. For example: <form class="form theme-form" method="POST" action="edit_firm.php?id=<?php echo $firm_id; ?>" autocomplete="off"> Here, edit_firm.php is the PHP file that will handle the form submission, and $firm_id is the id of the record to be edited. Retrieve the id of the record to be edited from the query parameter in the URL. For example: if (isset($_GET['id'])) { $firm_id = $_GET['id']; } else { // handle error if id is not present in URL } Update the SQL query to use the UPDATE statement instead of INSERT, and set the values of the fields to be updated using the form data. For example: $sqleditfirm = "UPDATE firms SET firm_legalname=?, firmbusinessname=?, firmbusiness_addresss=?, firmbusiness_city=?, firmbusiness_state=?, firmbusiness_pin=?, firmbusiness_phone=?, firmbusiness_country=? WHERE id=?"; $stmtditfirm = $conn->prepare($sqleditfirm); $stmtditfirm->bind_param("ssssssssi", $addfirm_legalname, $addfirm_businessname, $addfirm_address, $addfirm_city, $addfirm_state, $addfirm_pin, $addfirm_phone, $addfirm_country, $firm_id); Here, id is the name of the primary key column in the firms table. Retrieve the existing values of the fields for the record to be edited from the database using the id, and prepopulate the form fields with these values. For example: // Retrieve existing values of the fields for the record to be edited $sqlgetfirm = "SELECT * FROM firms WHERE id=?"; $stmtgetfirm = $conn->prepare($sqlgetfirm); $stmtgetfirm->bind_param("i", $firm_id); $stmtgetfirm->execute(); $resultgetfirm = $stmtgetfirm->get_result(); $rowgetfirm = $resultgetfirm->fetch_assoc(); // Prepopulate the form fields with existing values $addfirm_legalname = $rowgetfirm['firm_legalname']; $addfirm_businessname = $rowgetfirm['firmbusinessname']; $addfirm_address = $rowgetfirm['firmbusiness_addresss']; $addfirm_city = $rowgetfirm['firmbusiness_city']; $addfirm_state = $rowgetfirm['firmbusiness_state']; $addfirm_pin = $rowgetfirm['firmbusiness_pin']; $addfirm_country = $rowgetfirm['firmbusiness_country']; $addfirm_phone = $rowgetfirm['firmbusiness_phone']; Note that you also need to handle any errors that may occur during the editing process. For example, you can display an error message if the record with the specified id is not found in the database.
  24. Sorry for my English, but to save time I had to use GT on some of my postings. Usually, I don't do that. Sometimes it works well, and sometimes it doesn't. I have read thru your code a couple of times, and I think I understand it. If I don't, please put me on the right track again. I am only a human and not a machine. The possibility of being wrong is there, and I'm not very good at this, but I try. I have not read thru the other answers in the thread, so sorry if I step on someone's toes. Shot in the blind.... From your code, it seems you are using checkboxes to select multiple items for deletion from a table. Right? However, you mentioned that only the first checkbox is working, even when you select the last checkbox. One issue I see with your code is that you are using the same name attribute for all the checkboxes, which means they will all have the same value when they are submitted. This could be causing the problem you are experiencing. To fix this issue, you need to give each checkbox a unique name attribute value that corresponds to the product ID for that particular item. You can do this by appending the product ID to the name attribute value of each checkbox using square brackets, like this: <input type='checkbox' name='check_list[<?= $prod_id ?>]' value='<?= $prod_id ?>' > In the above code, we are appending the product ID to the name attribute value of the checkbox using PHP. This will ensure that each checkbox has a unique name attribute value that corresponds to the product ID for that particular item. Then, in your PHP code, you can loop through the $_POST['check_list'] array to get the product IDs of the selected items, like this: if(!empty($_POST['check_list'])) { foreach($_POST['check_list'] as $prod_id) { // Delete the item with this product ID } } By doing this, you should be able to select multiple items for deletion using checkboxes and delete them successfully.
×
×
  • 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.