hi, i need do one scipt that employer can accept and reject requests for product, then print the information about the follwing product.The customers fills out a form after the custumers sends the request. please somebody help me!!!
Dani AI
Generated
A practical, secure way to implement the accept/reject + print workflow is to treat each customer submission as a row in a requests table, provide an authenticated admin page that lists requests with POST-driven Accept / Reject actions, and expose a separate minimal "print" view that the employer opens (or prints via window.print()). As asked, decide first whether the request is a single free-text field or a set of structured product fields — that determines whether you need one simple table or a normalized design with product/request relationships. This also answers : break the work into (1) store the submission, (2) admin UI for state changes, (3) printable view.
Example minimal table:
CREATE TABLE requests (
id INT AUTO_INCREMENT PRIMARY KEY,
customer_name VARCHAR(150),
email VARCHAR(255),
product_desc TEXT,
status ENUM('pending','accepted','rejected') DEFAULT 'pending',
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
); Update handler (high level): require an authenticated session, validate a CSRF token, then run a prepared statement to change status. Use POST for the action — never change state via a raw GET link.
session_start();
// verify admin login and CSRF token here
$pdo = new PDO($dsn, $user, $pass);
$stmt = $pdo->prepare("UPDATE requests SET status = ? WHERE id = ?");
$stmt->execute([$newStatus, $id]);
header('Location: admin_requests.php');
exit; Printable view: build print.php?id=123 that verifies admin rights, fetches the row with a prepared statement, outputs escaped HTML via htmlspecialchars(), and calls window.print() or uses a print stylesheet (@media print) for layout. If a PDF is required, generate one server-side with a library. Key cautions: always use prepared statements (see the PHP PDO manual), escape output for HTML, require authentication for state changes and print pages, and log acceptance/rejection actions for audit. For PDO details see PDO — PHP Manual. For client print behavior see window.print() — MDN.
EverWebby 1 Light Poster
On the surface it sounds easy, but you need to further elaborate on your problem. How is the product described? Does it integrate with a database with perhaps 30 fields that describe the product or is it just one field to do this?
So what you are saying is that there is a page with contact form elements that a potential customer goes to, he or she arbitrarily just enters into what he would like from the supplier (one data input field providing a name of a product and perhaps a UPC). It gets sent to the (company) website owner. He then opens the email, clicks a link, sees the contents of the message on the server, hits a file print button, and then replies with a response to the customer?
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.