Grammatical Features By Sura Chart - warwickfoster/qurantools GitHub Wiki

File: app/formulae/selection_formulae_analyse.php

Purpose

This PHP code snippet provides a page that allows users to search for verses containing specific formulae. It features the following functionalities:

Features

  • Allows users to enter a formula in a search box.
  • Displays results in a table, showing the corresponding verses, suras, and the number of occurrences.
  • Provides cross-references to other verses with similar formulae.
  • Shows statistics on the number of formulae, cross-references, and suras involved.

Code Structure

  • The code includes necessary HTML, CSS, and JavaScript elements for the page.
  • It connects to a database to retrieve verse data.
  • It uses PHP functions to perform the search and generate the results table.
  • It includes a footer and header for the website.

Code Explanation

1. Search Form

  • A form is created with an input field for the formula and a submit button.
  • The input field accepts user input and sends it to the server through a POST request.

2. Database Query

  • The PHP script receives the user input and connects to the database.
  • It executes a SQL query to search for verses containing the specified formula.
  • The query returns results in an array of rows.

3. Results Table

  • The script iterates through the rows and creates a table with columns for Surah, Verse, Formula, Internal Cross-references, External Cross-references, and Mecca/Medina references.
  • Each row represents a verse found in the search results.

4. Statistics

  • The script calculates statistics based on the search results, such as the total number of formulae, cross-references, and suras involved.

5. Footer and Header

  • The code includes a footer and header for the website, providing necessary navigation and branding elements.

Conclusion

This PHP code provides a comprehensive solution for searching and analyzing verses based on formulae. It offers a user-friendly interface and insightful statistics, allowing users to explore the relationship between formulae and verses in the Quran.