A simple PHP + MySQL form to store movie details with server-side validation and prepared statements.
- PHP 7.4+ (XAMPP/LAMPP OK)
- MySQL/MariaDB
- Web server serving this folder (e.g.,
http://localhost/Movie_archive_form/)
- Update database credentials in
db.phpif needed. - Create the database
movie_archiveand themoviestable:- Import
schema.sqlinto your MySQL server, or run the SQL manually.
- Import
See schema.sql for the table definition:
CREATE TABLE movies (
id INT AUTO_INCREMENT PRIMARY KEY,
movie_name VARCHAR(255) NOT NULL,
movie_type VARCHAR(100) NOT NULL,
release_date DATE NOT NULL,
producer_name VARCHAR(255) NOT NULL,
rotten_tomato_rating DECIMAL(3,1) NOT NULL
);- Open
index.phpin your browser. - Fill the form and submit. You will be redirected back with a success or error message.
You can use curl to simulate a form submission:
curl -i -X POST \
-d "movie_name=Inception" \
-d "movie_type=Sci-Fi" \
-d "release_date=2010-07-16" \
-d "producer_name=Emma Thomas" \
-d "rating=8.8" \
http://localhost/Movie_archive_form/store.php(After submission, you should be redirected to index.php with a success message.)
- Input validation enforces date format
YYYY-MM-DDand rating between0and10. - Database connection uses
utf8mb4charset for full Unicode support.
The page includes a subtle movie-themed background (assets/movie-bg.svg) layered under gradient overlays.
- To customize, replace
assets/movie-bg.svgwith your own image (e.g.,assets/my-movie.jpg) and updateassets/styles.cssbody background to point to it. - Recommended size: 1920x1080 or higher; use visually soft imagery to keep the form readable.