File Manager
Editing: process_request.php
<?php // Enable error reporting ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); $host = "127.0.0.1:3306"; // Change if your MySQL server is hosted elsewhere $username = "u404542307_dacotywebsites"; // Your MySQL username $password = "daCotywebs1te5"; // Your MySQL password $database = "u404542307_eizon"; // Your MySQL database name try { $pdo = new PDO("mysql:host=$host;dbname=$database", $username, $password); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch (PDOException $e) { die("Could not connect to the database: " . $e->getMessage()); } if ($_SERVER['REQUEST_METHOD'] === 'POST') { $productName = $_POST['product_name']; $description = $_POST['description']; $location = $_POST['location']; $countryCode = $_POST['country_code']; // Country code $phoneNumber = $_POST['phone_number']; // Phone number without country code $sql = "INSERT INTO requests (product_name, description, location, country_code, phone_number) VALUES (:product_name, :description, :location, :country_code, :phone_number)"; $stmt = $pdo->prepare($sql); try { $stmt->execute([ 'product_name' => $productName, 'description' => $description, 'location' => $location, 'country_code' => $countryCode, 'phone_number' => $phoneNumber ]); // Redirect to the Product Requests page header("Location: /requests_page"); exit; // Ensure no further script is executed } catch (PDOException $e) { die("Error: " . $e->getMessage()); } } ?>
💾 Save
⬅ Back