lucasbrasantos / carsPHP

carsPHP
1 stars 0 forks source link

Feature/search-function #3

Closed lucasbrasantos closed 4 months ago

lucasbrasantos commented 4 months ago

Search Feature Description

This pull request adds a search functionality to the carsPHP application, enhancing the user experience by allowing users to filter the displayed cars based on specific criteria.

Key Features:

  1. Search Bar Integration:

    • The search bar is integrated into the navbar on the main page (index.php).
    • Users can type a query into the search bar to filter cars based on the marca or cor.
  2. Dynamic Filtering:

    • The search functionality dynamically filters the cars displayed in the table based on the user's input.
    • The filtering is case-insensitive and matches partial strings, providing flexible search capabilities.
  3. SQL Query Enhancement:

    • The SQL query has been enhanced to include a WHERE clause that filters results based on the search query.
    • Prepared statements are used to safely handle user input and prevent SQL injection.
  4. User Feedback:

    • When no cars match the search criteria, a message "Nenhum resultado" is displayed in the table.
    • This ensures users receive immediate feedback on their search actions.
  5. Maintain Page Structure:

    • The search results are displayed within the existing table structure, ensuring a consistent user interface.
    • All relevant car details (ID, Marca, Cor, Ano, Preço, Usado, Adicionais) are shown for the filtered results.

How to Use:

  1. Navigate to the main page (index.php).
  2. Type a search query into the search bar located in the navbar (e.g., a car brand or color).
  3. Press Enter in the search bar to trigger the search.
  4. View the filtered results in the table below.

This search feature significantly improves the usability of the carsPHP application, making it easier for users to find specific cars based on their preferences.