Search⌘ K

Add a Project

Explore how to add new projects in a PHP and MySQL CRUD application by creating a form, handling form submission securely with prepared statements, and validating input data to ensure proper database insertion.

We'll cover the following...

The form

At the root of our project, we’ll add the project.php file.

First, we’ll create a form like this:

<form method="post">
   <label for="title">Title</label>
   <input type="text" placeholder="New project" name="title" id="title">
   <label for="category">Category</label>
   <select name="category" id="category">
      <option value="">Select a category</option>
      <option value="Professional">Professional</option>
       <option value="Personal">Personal</option>
       <option value="Charity">Charity</option>
</select>
<input type="submit" name="submit" value="Add">
</form>

We need a little CSS, so we’ve created a style.css file in the root as well: ...