Hi all. sory but im beginner on web creating. I need create catalog. first page i need create item add form. after page i need create items catalog. all on mysql sory for bat English :) who can help me. i have login register index pages.

Dani AI

Generated

A compact, practical roadmap that builds on ’s advice to sketch a plan and on ’s suggestion as a quick alternative. The original post by mentions trying to write form data to a file; that can work for tiny prototypes but a MySQL table is far more robust for a catalog (searching, editing, pagination, concurrent users). With login/register pages already present, add-item functionality should be served only to authenticated users and the server handler must validate and sanitize all inputs.

Create a simple table:

CREATE TABLE items (
  id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
  title VARCHAR(255) NOT NULL,
  description TEXT,
  price DECIMAL(10,2),
  image VARCHAR(255),
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

Minimal HTML form (note the multipart encoding for file uploads):

<form method="post" action="add_item.php" enctype="multipart/form-data">
  <input name="title" type="text" required>
  <textarea name="description"></textarea>
  <input name="price" type="number" step="0.01">
  <input name="image" type="file" accept="image/*">
  <button type="submit">Add Item</button>
</form>

Example server-side flow (use PDO + prepared statements, validate uploads, store filenames not raw blobs):

// (simplified) add_item.php
$pdo = new PDO('mysql:host=localhost;dbname=DB;charset=utf8mb4','user','pass',[PDO::ATTR_ERRMODE=>PDO::ERRMODE_EXCEPTION]);
$title = trim($_POST['title'] ?? '');
$desc  = trim($_POST['description'] ?? '');
$price = $_POST['price'] !== '' ? (float)$_POST['price'] : null;
// handle image: check extension/size, generate unique name, move_uploaded_file(), save path in DB
$stmt = $pdo->prepare('INSERT INTO items (title,description,price,image) VALUES (:t,:d,:p,:i)');
$stmt->execute([':t'=>$title,':d'=>$desc,':p'=>$price,':i'=>$imagePath ?? null]);

Troubleshooting & security notes: enable PDO MySQL, confirm DB credentials, make the uploads directory writable and prevent executable uploads, check form field names match handler, always use prepared statements and htmlspecialchars() when rendering, and include a CSRF token on the form. For a fast temporary solution, exporting form submissions to CSV is possible, but for a lasting catalog the MySQL approach above scales and simplifies management.

Recommended Answers

All 4 Replies

There are plenty of people here to help you but no one is going to write the code for you so, my suggestion is for you to develop a high level plan for this project, come up with pseudo-code and then ask questions here that are very specific about problem you encounter. At that time, you would post the relevent code and details about the problem you are having.

So on the main page, you need to create a form? what problem related to the form are you having?

i need help create form. form can create new file and write informacion in file. im trying but nothing gud please help

You need help with the form itself? A form is basically a group of input elements that are within the form element.

If you are not that familiar with HTML, you are going to have a challenge on your hands. putting together the HTML needed for the form is the easy part. What to do when the form is submitted requires server side processing. You will need to develop code on your own to handle the submission of the form.

There are sites online that help you build forms such as

There are other sites that handle the processing of your forms.

I'd recommend you start by learning HTML and how the <form> element works.

Maybe start on W3Schools. Very basic and will get you going..

http://www.w3schools.com/html/html_forms.asp

Not knowing exactly what you're struggling with and for the looks of it, you're getting stuck right at the beggining I would suggest . It might just give you all you need.

Give us more information if all this doesn't work for you.

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.