<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ramindu Nimesh on Medium]]></title>
        <description><![CDATA[Stories by Ramindu Nimesh on Medium]]></description>
        <link>https://medium.com/@ramindunimesh61?source=rss-b3e987517295------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*yjsWyX4x4xP_vWC2</url>
            <title>Stories by Ramindu Nimesh on Medium</title>
            <link>https://medium.com/@ramindunimesh61?source=rss-b3e987517295------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 17:06:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ramindunimesh61/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Demystifying CI/CD Pipelines: A Developer’s Journey]]></title>
            <link>https://medium.com/@ramindunimesh61/demystifying-ci-cd-pipelines-a-developers-journey-42610d75333e?source=rss-b3e987517295------2</link>
            <guid isPermaLink="false">https://medium.com/p/42610d75333e</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <dc:creator><![CDATA[Ramindu Nimesh]]></dc:creator>
            <pubDate>Sat, 06 Jul 2024 10:41:43 GMT</pubDate>
            <atom:updated>2024-07-06T10:41:43.904Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*We7hrVHeqzhHjMLjoDv-Mg.jpeg" /></figure><blockquote><strong><em>In the fast-paced software development world, delivering high-quality software quickly and efficiently is crucial. As a developer focused on enhancing my workflow, I have discovered that Continuous Integration and Continuous Delivery (CI/CD) pipelines are game-changers. In this blog post, I will share what I’ve learned about CI/CD, why it’s important, and how you can set up your own CI/CD pipeline to streamline your development process.</em></strong></blockquote><h3><strong>Understanding CI/CD</strong></h3><blockquote><strong><em>Continuous Integration (CI)</em></strong><em> is a development practice in which developers frequently integrate code into a shared repository, ideally several times daily. Each integration is validated by automated builds and tests, enabling teams to identify issues early.</em></blockquote><blockquote><strong><em>Continuous Delivery (CD)</em></strong><em> ensures that the codebase is always ready for deployment. Any change that successfully completes all stages of the production pipeline is prepared for release to users.</em></blockquote><blockquote><strong><em>Continuous Deployment</em></strong><em> takes this a step further by automatically deploying every successful change to production without the need for human intervention.</em></blockquote><h3><strong>Components of a CI/CD Pipeline</strong></h3><blockquote><strong><em>A typical CI/CD pipeline includes several key components:</em></strong></blockquote><blockquote><strong><em>Source Code Repository:</em></strong><em> This is the central place where code is stored and managed. (GitHub)</em></blockquote><blockquote><strong><em>Build Automation:</em></strong><em> These are the tools that are used to compile and build the code. Popular choices for this are Jenkins and GitHub Actions.</em></blockquote><blockquote><strong><em>Testing Automation:</em></strong><em> These are automated tests that run to ensure code quality. My preferred tools for this are Jest for JavaScript and JUnit for Java.</em></blockquote><blockquote><strong><em>Deployment Automation: </em></strong><em>These are the tools that automate the deployment of code to different environments. (Docker, Kubernetes)</em></blockquote><h3><strong>Setting Up a CI/CD Pipeline</strong></h3><blockquote><strong><em>Let’s get started by setting up a simple CI/CD pipeline using GitHub Actions.</em></strong></blockquote><blockquote><strong><em>Step 1:</em></strong><em> Creating a Repository Begin by creating a repository on GitHub. This is where your code will be stored.</em></blockquote><blockquote><strong><em>Step 2: </em></strong><em>Adding a Workflow File Inside the repository, create a .github/workflows directory and add a workflow YAML file. This file will outline the steps of your pipeline.</em></blockquote><blockquote><strong><em>Step 3:</em></strong><em> Defining the Workflow Within the YAML file, specify the steps for building, testing, and deploying your application. Here’s an example for a Node.js project:</em></blockquote><pre>name: CI/CD Pipeline<br><br>on:<br>  push:<br>    branches:<br>      - main<br><br>jobs:<br>  build:<br>    runs-on: ubuntu-latest<br>    steps:<br>      - name: Checkout code<br>        uses: actions/checkout@v2<br><br>      - name: Set up Node.js<br>        uses: actions/setup-node@v2<br>        with:<br>          node-version: &#39;14&#39;<br><br>      - name: Install dependencies<br>        run: npm install<br><br>      - name: Run tests<br>        run: npm test<br><br>      - name: Deploy to production<br>        if: success()<br>        run: npm run deploy</pre><blockquote><strong><em>This workflow does the following:</em></strong></blockquote><blockquote><em>Checks out the code.</em></blockquote><blockquote><em>Sets up Node.js.</em></blockquote><blockquote><em>Installs dependencies.</em></blockquote><blockquote><em>Runs tests.</em></blockquote><blockquote><em>Deploys to production if tests pass.</em></blockquote><h3><strong>Best Practices for CI/CD</strong></h3><blockquote><strong><em>Commit Early and Often:</em></strong><em> Make regular commits to catch issues early on.</em></blockquote><blockquote><strong><em>Write and Maintain Good Tests:</em></strong><em> Keep your tests thorough and up-to-date.</em></blockquote><blockquote><strong><em>Keep the Pipeline Fast:</em></strong><em> Optimize your pipeline for quick feedback.</em></blockquote><blockquote><strong><em>Monitor and Maintain Your Pipeline:</em></strong><em> Regularly inspect your pipeline for issues.</em></blockquote><h3><strong>Conclusion</strong></h3><blockquote><strong><em>CI/CD pipelines are a powerful tool for modern software development. Automating the integration, testing, and deployment processes enables teams to deliver high-quality software more quickly and reliably. I encourage you to start implementing CI/CD in your projects today to experience the benefits firsthand.</em></strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=42610d75333e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Embracing the Future: A Visual Journey into the MERN Stack]]></title>
            <link>https://medium.com/@ramindunimesh61/embracing-the-future-a-visual-journey-into-the-mern-stack-9b866c3b765e?source=rss-b3e987517295------2</link>
            <guid isPermaLink="false">https://medium.com/p/9b866c3b765e</guid>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[blog]]></category>
            <category><![CDATA[full-stack-developer]]></category>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[mern-stack]]></category>
            <dc:creator><![CDATA[Ramindu Nimesh]]></dc:creator>
            <pubDate>Wed, 20 Dec 2023 07:32:21 GMT</pubDate>
            <atom:updated>2023-12-20T07:32:21.576Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gIcD54mrHY7LUYxTZ8M0tA.jpeg" /></figure><blockquote><strong><em>In the ever-evolving landscape of web development, staying at the forefront of technology is crucial. One such technology stack that has gained immense popularity is the MERN stack — a powerful combination of MongoDB, Express.js, React.js, and Node.js. In this blog post, we’ll explore the key components of the MERN stack and understand why it has become a go-to choice for building robust and scalable web applications.</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/943/1*ZupTkiEbb9-Tbkl-l6ayEg.png" /></figure><h3><strong>MongoDB: The NoSQL Database</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/225/1*x45sMWn-RDIrgTsRVz_SpA.png" /></figure><blockquote><strong><em>At the heart of the MERN stack lies MongoDB, a document-oriented NoSQL database. MongoDB’s flexibility and scalability make it an ideal choice for handling large amounts of data. With its JSON-like document structure, MongoDB allows developers to store data in a format that closely resembles the way data is represented in their application code. This seamless integration between the application and the database simplifies the development process and accelerates iteration cycles.</em></strong></blockquote><h3><strong>Express.js: The Web Application Framework</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q6b32yNdlpyQjDZlAc1QEg.png" /></figure><blockquote><strong><em>Express.js is a minimal and flexible Node.js web application framework that complements MongoDB. It simplifies the process of building web applications and APIs, providing a set of robust features for web and mobile applications. With Express, developers can create scalable and maintainable server-side applications, handling tasks such as routing, middleware management, and request handling with ease.</em></strong></blockquote><h3><strong>React.js: The Declarative UI Framework</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/225/1*KjQwPjufObm4XsnarmlaoA.png" /></figure><blockquote><strong><em>React.js, developed by Facebook, is a declarative JavaScript library for building user interfaces. Its component-based architecture allows developers to create reusable UI elements, making it easier to manage and scale complex applications. React’s virtual DOM ensures efficient updates, resulting in faster rendering and a smoother user experience. The seamless integration of React with the MERN stack enables the development of interactive and dynamic user interfaces.</em></strong></blockquote><h3><strong>Node.js: The JavaScript Runtime Environment</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*HRmPomnuo1YjOJ03sQ-RAw.jpeg" /></figure><blockquote><strong><em>Node.js is a server-side JavaScript runtime environment that executes JavaScript code outside of a browser. When combined with Express.js, Node.js enables the development of server-side applications with a non-blocking, event-driven architecture. This combination allows developers to build highly scalable and performant applications, handling a large number of simultaneous connections efficiently.</em></strong></blockquote><h3><strong>Bringing It All Together: The MERN Stack in Action</strong></h3><blockquote><strong><em>The synergy between MongoDB, Express.js, React.js, and Node.js creates a cohesive development environment. MongoDB stores the data, Express.js handles the server-side logic, React.js manages the user interface, and Node.js serves as the runtime environment. This full-stack JavaScript approach streamlines the development process, allowing for faster prototyping, efficient collaboration between front-end and back-end developers, and easier maintenance.</em></strong></blockquote><h3><strong>Benefits of Choosing the MERN Stack</strong></h3><blockquote><strong><em>Consistency: </em></strong><em>With JavaScript as the primary language for both front-end and back-end development, developers can maintain consistency throughout the entire stack.</em></blockquote><blockquote><strong><em>Scalability: </em></strong><em>The MERN stack is designed to handle the demands of scalable applications, making it suitable for projects of varying sizes.</em></blockquote><blockquote><strong><em>Developer Productivity: </em></strong><em>The modular and component-based nature of React, along with the extensive npm ecosystem, enhances developer productivity and speeds up the development process.</em></blockquote><blockquote><strong><em>Community Support:</em></strong><em> Each component of the MERN stack has a vibrant and active community, providing a wealth of resources, tutorials, and third-party libraries to aid developers.</em></blockquote><h3><strong>Conclusion:</strong></h3><blockquote><strong><em>The MERN stack stands as a testament to the power of full-stack JavaScript development. By seamlessly integrating MongoDB, Express.js, React.js, and Node.js, developers can create modern, scalable, and feature-rich web applications. As the tech world continues to evolve, the MERN stack remains a robust choice for those looking to build innovative and high-performance web solutions. Embrace the MERN stack, and unlock a world of possibilities for your next web development project.</em></strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9b866c3b765e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a simple crud operation with a Search engine for storing student records using PHP & MySQL]]></title>
            <link>https://medium.com/@ramindunimesh61/building-a-simple-crud-operation-with-a-search-engine-for-storing-student-records-using-php-mysql-8d317e029849?source=rss-b3e987517295------2</link>
            <guid isPermaLink="false">https://medium.com/p/8d317e029849</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[crud]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[css]]></category>
            <dc:creator><![CDATA[Ramindu Nimesh]]></dc:creator>
            <pubDate>Fri, 14 Jul 2023 08:08:02 GMT</pubDate>
            <atom:updated>2023-07-14T08:44:09.197Z</atom:updated>
            <content:encoded><![CDATA[<h3>what is a PHP crud operation ?</h3><p>PHP CRUD operation refers to performing Create, Read, Update, and Delete operations on a database using PHP. It is a common approach in web development for managing data in a database.</p><p>Here’s a brief explanation of each operation:</p><blockquote><em>Create : Creating new records or entries in a database. This involves inserting data into the database tables.</em></blockquote><blockquote><em>Read : Retrieving or reading data from the database. This operation allows you to fetch and display data from the database tables.</em></blockquote><blockquote><em>Update : Modifying existing records in the database. It involves updating the values of specific fields or columns in the database tables.</em></blockquote><blockquote><em>Delete : Removing or deleting records from the database. This operation allows you to remove specific data entries from the database tables.</em></blockquote><p><strong>CRUD operations are fundamental for building dynamic web applications that interact with a database. They provide the basic functionality for managing data and allow users to create, view, edit, and delete records in the application.</strong></p><h4>The source code can be accessed <a href="https://github.com/ramindu-Nimex/My_Blogs/tree/main/CRUD%20operation">here</a>.</h4><h3>Now , let’s begin.</h3><p>I will be building a simple application for collecting Student records using MySQL and PHP.<br>First of all , you need to install a code editor(such as vs code), MySQL database and xampp server.<br>we have to create the Database for storing the student records before doing anything else.</p><p><strong>The SQL command below is used in creating a Database.</strong></p><pre>create database crud;</pre><p>After creating the Database the next thing to create is the TABLE which will be holding all our data.<br>A table is like a compartment in our database consisting of column(s) and row (s) for storing our records.</p><p>Our table will be consisting of 5 columns which are : name, phone, age, gender and faculty.</p><p><strong>This is the SQL command to create the Table and the column :</strong></p><pre>create table students (<br>    id int primary key auto_increment,<br>    name varchar(100) not null,<br>    phone varchar(100) not null,<br>    age varchar(100) not null,<br>    gender varchar(500) not null,<br>    faculty varchar(100) not null<br>);</pre><p>The structure of the table should look like this after executing the SQL command :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/487/1*MTEKaznMMzZIube5S_q1Jg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/370/1*iYw7ZXzIZlmexAwp-OwsPg.png" /></figure><p>Next step, go ahead and set up a new folder. I’m gonna call it “CRUD OPERATION” but you can call yours whatever you want.</p><p><strong>The file path is given below:</strong></p><h4><strong>C:\xampp\htdocs\CRUD OPERATION</strong></h4><p>Go ahead and open that folder in the code editor and create the necessary files and folder.</p><p>this is my project folder,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/255/1*PuVEtUMxI7SrZGGWhQr-dw.png" /></figure><p>The next thing now is to connect it to our database using PHP.</p><p><strong>Create a new file and name it “config.php”. Here is the code to connect to the database.</strong></p><pre>// config.php<br><br>&lt;?php<br><br>   $serverName = &#39;localhost&#39;;<br>   $userName = &#39;root&#39;;<br>   $password = &#39;&#39;; // if do you have a MySQL password put it<br>   $dbName = &#39;crud&#39;;<br><br>   // create connection<br>   $conn = new mysqli($serverName, $userName, $password, $dbName);<br><br>   // check connection<br>   if($conn-&gt;connect_error) {<br>      die(&quot;connection failed&quot; . $conn-&gt;connect_error);<br>   }<br>   else {<br>      echo &quot;connection successfully &lt;br&gt;&quot;;<br>   }<br><br>?&gt;</pre><p><em>The “$serverName”, “$userName”, “$password”, and “$dbName” variables hold the necessary information to connect to the MySQL server. Modify these values according to your specific database configuration. The new “mysqli()” statement creates a new MySQLi object, representing the database connection. It takes the server name, username, password, and database name as parameters. The “connect_error” property is used to check if the connection to the database was successful. If there is an error, the “die()” function is called, terminating the script execution and displaying the error message. If the connection is successful, the “connection successfully” message is displayed in the browser.</em></p><p>Now let’s create the student registration form for collecting the student data. I name it<strong> “create.php”.</strong></p><p><strong>Here is the code.</strong></p><pre>// create.php<br><br>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>&lt;head&gt;<br>   &lt;meta charset=&quot;UTF-8&quot;&gt;<br>   &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;<br>   &lt;title&gt;Student Records&lt;/title&gt;<br>   &lt;link rel=&quot;stylesheet&quot; href=&quot;css/style.css&quot;&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>   &lt;section&gt;<br>      &lt;h1&gt;Student Registration Form&lt;/h1&gt;<br>      &lt;form action=&quot;process.php&quot; method=&quot;post&quot;&gt;<br>         &lt;div class=&quot;inputbox&quot;&gt;<br>            &lt;label for=&quot;&quot;&gt;Full Name : &lt;/label&gt;<br>            &lt;input type=&quot;text&quot; name=&quot;name&quot; placeholder=&quot;Enter Full Name&quot; required&gt;<br>         &lt;/div&gt;<br><br>         &lt;div class=&quot;inputbox&quot;&gt;<br>            &lt;label for=&quot;&quot;&gt;Mobile Number : &lt;/label&gt;<br>            &lt;input type=&quot;text&quot; name=&quot;phone&quot; placeholder=&quot;Enter Mobile Number&quot; required&gt;<br>         &lt;/div&gt;<br><br>         &lt;div class=&quot;inputbox&quot;&gt;<br>            &lt;label for=&quot;&quot;&gt;Age : &lt;/label&gt;<br>            &lt;input type=&quot;number&quot; name=&quot;age&quot; placeholder=&quot;Enter Student Age&quot; required&gt;<br>         &lt;/div&gt;<br><br>         &lt;div class=&quot;inputbox&quot;&gt;<br>            &lt;label for=&quot;&quot;&gt;Gender : &lt;/label&gt;<br>            &lt;select name=&quot;gender&quot;&gt;<br>               &lt;option value=&quot;&quot;&gt;Select Gender&lt;/option&gt;<br>               &lt;option value=&quot;Male&quot;&gt;Male&lt;/option&gt;<br>               &lt;option value=&quot;Female&quot;&gt;Female&lt;/option&gt;<br>               &lt;option value=&quot;Others&quot;&gt;Others&lt;/option&gt;<br>            &lt;/select&gt;<br>         &lt;/div&gt;<br><br>         &lt;div class=&quot;inputbox&quot;&gt;<br>            &lt;label for=&quot;&quot;&gt;Faculty : &lt;/label&gt;<br>            &lt;select name=&quot;faculty&quot;&gt;<br>               &lt;option value=&quot;&quot;&gt;Select Faculty&lt;/option&gt;<br>               &lt;option value=&quot;Computing&quot;&gt;Computing&lt;/option&gt;<br>               &lt;option value=&quot;Business&quot;&gt;Business&lt;/option&gt;<br>               &lt;option value=&quot;Engineering&quot;&gt;Engineering&lt;/option&gt;<br>               &lt;option value=&quot;Humanities &amp; Science&quot;&gt;Humanities &amp; Science&lt;/option&gt;<br>               &lt;option value=&quot;Architecture&quot;&gt;Architecture&lt;/option&gt;<br>            &lt;/select&gt;<br>         &lt;/div&gt;<br><br>         &lt;div class=&quot;inputbox&quot;&gt;<br>            &lt;input type=&quot;submit&quot; value=&quot;Submit&quot; name=&quot;create&quot; class=&quot;formbtn&quot;&gt;<br>        &lt;/div&gt;<br>      &lt;/form&gt;<br>   &lt;/section&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*qU_mPxZ1RHYuoaQ6cO_lKA.png" /></figure><p>The form uses the POST method and submits data to a PHP script called <strong>“process.php”</strong> using the action attribute of the &lt;form&gt; tag.</p><p>the action attribute specifies the URL or file where the form data will be submitted for processing. in this code, the form data will be sent to the <strong>“process.php” </strong>file for processing.</p><p><strong>Here is the “process.php” code,</strong></p><pre>// process.php<br><br>&lt;?php<br>   include &quot;config.php&quot;;<br><br>   if(isset($_POST[&#39;create&#39;])) {<br>      $name = $_POST[&#39;name&#39;];<br>      $phone = $_POST[&#39;phone&#39;];<br>      $age = $_POST[&#39;age&#39;];<br>      $gender = $_POST[&#39;gender&#39;];<br>      $faculty = $_POST[&#39;faculty&#39;];<br><br>      $sql = &quot;INSERT INTO students(name, phone, age, gender, faculty) VALUES(&#39;$name&#39;,&#39;$phone&#39;,&#39;$age&#39;,&#39;$gender&#39;,&#39;$faculty&#39;)&quot;;<br>      $result = mysqli_query($conn,$sql);<br><br>      if($result) {<br>         header(&#39;location:view.php&#39;);<br>      }<br>      else {<br>         die(mysqli_error($conn));<br>      }<br>   }<br><br>   if(isset($_POST[&#39;update&#39;])) {<br>      $id = $_POST[&#39;id&#39;];<br>      $name = $_POST[&#39;name&#39;];<br>      $phone = $_POST[&#39;phone&#39;];<br>      $age = $_POST[&#39;age&#39;];<br>      $gender = $_POST[&#39;gender&#39;];<br>      $faculty = $_POST[&#39;faculty&#39;];<br><br>      $sql = &quot;UPDATE students SET name = &#39;$name&#39;, phone = &#39;$phone&#39;, age = &#39;$age&#39;, gender = &#39;$gender&#39;, faculty = &#39;$faculty&#39; WHERE id=&#39;$id&#39;&quot;;<br>      $result = mysqli_query($conn,$sql);<br><br>      if($result) {<br>         header(&#39;location:view.php&#39;);<br>      }<br>      else {<br>         die(mysqli_error($conn));<br>      }<br>   }<br><br>   $conn-&gt;close();<br>?&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*XoYk5vOEtgXDnB5s8Jn7gg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/501/1*72n82fOg1w7V7trOJO4s4A.png" /></figure><p>The code includes the “config.php” file, which presumably contains the database connection details and sets up the $conn variable as the database connection object.</p><p>this code handles the creation and updating of student records in the database based on the data submitted through the registration and update forms. It ensures proper error handling and redirects to the appropriate pages after successful operations.</p><p><strong>Now let’s create a “view.php” file, Here is the code.</strong></p><pre>// view.php<br><br>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>&lt;head&gt;<br>   &lt;meta charset=&quot;UTF-8&quot;&gt;<br>   &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;<br>   &lt;title&gt;View Student Details&lt;/title&gt;<br>   &lt;link rel=&quot;stylesheet&quot; href=&quot;css/view.css&quot;&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>   &lt;section&gt;<br>      &lt;div class=&quot;tableviewhead&quot;&gt;<br>         &lt;h1&gt;Student Registration List&lt;/h1&gt;<br>         &lt;div class=&quot;left&quot;&gt;<br>            &lt;form action=&quot;search.php&quot; method=&quot;post&quot;&gt;<br>                &lt;input type=&quot;text&quot; placeholder=&quot;search data&quot; name=&quot;search&quot;&gt;<br>                &lt;button name=&quot;submit&quot;&gt;Search&lt;/button&gt;<br>            &lt;/form&gt;<br>            &lt;a href=&quot;./create.php&quot;&gt;Add&lt;/a&gt;<br>         &lt;/div&gt;<br>      &lt;/div&gt;<br><br>      &lt;table&gt;<br>         &lt;thead&gt;<br>            &lt;th&gt;ID&lt;/th&gt;<br>            &lt;th&gt;Full Name&lt;/th&gt;<br>            &lt;th&gt;Contact Number&lt;/th&gt;<br>            &lt;th&gt;Age&lt;/th&gt;<br>            &lt;th&gt;Gender&lt;/th&gt;<br>            &lt;th&gt;Faculty&lt;/th&gt;<br>            &lt;th colspan=&quot;2&quot;&gt;Action&lt;/th&gt;<br>         &lt;/thead&gt;<br><br>         &lt;tbody&gt;<br>            &lt;?php<br>               include &quot;config.php&quot;;<br>               $sql = &quot;SELECT * FROM students&quot;;<br>               $result = mysqli_query($conn, $sql);<br><br>               while($row = mysqli_fetch_assoc($result)) {<br>                  ?&gt;<br>                     &lt;tr&gt;<br>                        &lt;td&gt;&lt;?php echo $row[&quot;id&quot;]; ?&gt;&lt;/td&gt;<br>                        &lt;td&gt;&lt;?php echo $row[&quot;name&quot;]; ?&gt;&lt;/td&gt;<br>                        &lt;td&gt;&lt;?php echo $row[&quot;phone&quot;]; ?&gt;&lt;/td&gt;<br>                        &lt;td&gt;&lt;?php echo $row[&quot;age&quot;]; ?&gt;&lt;/td&gt;<br>                        &lt;td&gt;&lt;?php echo $row[&quot;gender&quot;]; ?&gt;&lt;/td&gt;<br>                        &lt;td&gt;&lt;?php echo $row[&quot;faculty&quot;]; ?&gt;&lt;/td&gt;<br><br>                        &lt;td&gt;<br>                           &lt;a href=&quot;read.php?id=&lt;?php echo $row[&quot;id&quot;]; ?&gt;&quot; target=&quot;_blank&quot; class=&quot;read&quot;&gt;Read More&lt;/a&gt;<br>                           &lt;a href=&quot;update.php?id=&lt;?php echo $row[&quot;id&quot;]; ?&gt;&quot; target=&quot;_blank&quot; class=&quot;update&quot;&gt;Update&lt;/a&gt;<br>                           &lt;a href=&quot;delete.php?id=&lt;?php echo $row[&quot;id&quot;]; ?&gt;&quot; target=&quot;_blank&quot; class=&quot;delete&quot;&gt;Delete&lt;/a&gt;<br>                        &lt;/td&gt;<br>                     &lt;/tr&gt;<br>                  &lt;?php<br>               }<br>            ?&gt;<br>         &lt;/tbody&gt;<br>      &lt;/table&gt;<br>   &lt;/section&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*8mfbNL38sxSCFOxiFZUnFg.png" /></figure><p>This PHP page displays a table view of student records retrieved from the database. It provides options to search for data, add new records, and perform read, update, and delete operations on individual records.</p><p><strong>Now let’s create a “update.php” file, Here is the code.</strong></p><pre>// update.php<br><br>&lt;?php<br>   include &quot;config.php&quot;;<br>   $id = $_GET[&#39;id&#39;];<br>   $sql = &quot;SELECT * FROM students WHERE id=$id&quot;;<br>   $result = mysqli_query($conn,$sql);<br>   $row = mysqli_fetch_assoc($result);<br>?&gt;<br><br>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>&lt;head&gt;<br>   &lt;meta charset=&quot;UTF-8&quot;&gt;<br>   &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;<br>   &lt;title&gt;Document&lt;/title&gt;<br>   &lt;link rel=&quot;stylesheet&quot; href=&quot;css/style.css&quot;&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>   &lt;section&gt;<br>      &lt;h1&gt;Update Student Registration Form&lt;/h1&gt;<br>      &lt;form action=&quot;process.php&quot; method=&quot;post&quot;&gt;<br>         &lt;div class=&quot;inputbox&quot;&gt;<br>            &lt;label for=&quot;&quot;&gt;Full Name : &lt;/label&gt;<br>            &lt;input type=&quot;text&quot; name=&quot;name&quot; value=&#39;&lt;?php echo $row[&#39;name&#39;]; ?&gt;&#39;&gt;<br>         &lt;/div&gt;<br><br>         &lt;div class=&quot;inputbox&quot;&gt;<br>            &lt;label for=&quot;&quot;&gt;Mobile Number : &lt;/label&gt;<br>            &lt;input type=&quot;text&quot; name=&quot;phone&quot; value=&#39;&lt;?php echo $row[&#39;phone&#39;]; ?&gt;&#39;&gt;<br>         &lt;/div&gt;<br><br>         &lt;div class=&quot;inputbox&quot;&gt;<br>            &lt;label for=&quot;&quot;&gt;Age : &lt;/label&gt;<br>            &lt;input type=&quot;number&quot; name=&quot;age&quot; value=&#39;&lt;?php echo $row[&#39;age&#39;]; ?&gt;&#39;&gt;<br>         &lt;/div&gt;<br><br>         &lt;div class=&quot;inputbox&quot;&gt;<br>            &lt;label for=&quot;&quot;&gt;Gender : &lt;/label&gt;<br>            &lt;select name=&quot;gender&quot;&gt;<br>               &lt;option value=&quot;&quot;&gt;Select Gender&lt;/option&gt;<br>               &lt;option value=&quot;Male&quot; &lt;?php if($row[&#39;gender&#39;] == &quot;Male&quot;){echo &quot;selected&quot;;} ?&gt;&gt;Male&lt;/option&gt;<br>               &lt;option value=&quot;Female&quot; &lt;?php if($row[&#39;gender&#39;] == &quot;Female&quot;){echo &quot;selected&quot;;} ?&gt;&gt;Female&lt;/option&gt;<br>               &lt;option value=&quot;Others&quot; &lt;?php if($row[&#39;gender&#39;] == &quot;Others&quot;){echo &quot;selected&quot;;} ?&gt;&gt;Others&lt;/option&gt;<br>            &lt;/select&gt;<br>         &lt;/div&gt;<br><br>         &lt;div class=&quot;inputbox&quot;&gt;<br>            &lt;label for=&quot;&quot;&gt;Faculty : &lt;/label&gt;<br>            &lt;select name=&quot;faculty&quot;&gt;<br>               &lt;option value=&quot;&quot;&gt;Select Faculty&lt;/option&gt;<br>               &lt;option value=&quot;Computing&quot; &lt;?php if($row[&#39;faculty&#39;] == &quot;Computing&quot;){echo &quot;selected&quot;;} ?&gt;&gt;Computing&lt;/option&gt;<br>               &lt;option value=&quot;Business&quot; &lt;?php if($row[&#39;faculty&#39;] == &quot;Business&quot;){echo &quot;selected&quot;;} ?&gt;&gt;Business&lt;/option&gt;<br>               &lt;option value=&quot;Engineering&quot; &lt;?php if($row[&#39;faculty&#39;] == &quot;Engineering&quot;){echo &quot;selected&quot;;} ?&gt;&gt;Engineering&lt;/option&gt;<br>               &lt;option value=&quot;Humanities &amp; Science&quot; &lt;?php if($row[&#39;faculty&#39;] == &quot;Humanities &amp; Science&quot;){echo &quot;selected&quot;;} ?&gt;&gt;Humanities &amp; Science&lt;/option&gt;<br>               &lt;option value=&quot;Architecture&quot; &lt;?php if($row[&#39;faculty&#39;] == &quot;Architecture&quot;){echo &quot;selected&quot;;} ?&gt;&gt;Architecture&lt;/option&gt;<br>            &lt;/select&gt;<br>         &lt;/div&gt;<br><br>         &lt;div class=&quot;inputbox&quot;&gt;<br>            &lt;input type=&quot;hidden&quot; name=&quot;id&quot; value=&#39;&lt;?php echo $row[&#39;id&#39;]; ?&gt;&#39;&gt;<br>         &lt;/div&gt;<br><br>         &lt;div class=&quot;inputbox&quot;&gt;<br>            &lt;input type=&quot;submit&quot; value=&quot;Update&quot; name=&quot;update&quot; class=&quot;formbtn&quot;&gt;<br>        &lt;/div&gt;<br>      &lt;/form&gt;<br>   &lt;/section&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*H3o6BHXtX4HHVFJMV6TNoA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/493/1*48DVcNVtCnkMZi46nuFDqA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*XNNW_GGoVAhRALcjvI5TDw.png" /></figure><p><strong>Now let’s create a “read.php” file, Here is the code.</strong></p><pre>// read.php<br><br>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>&lt;head&gt;<br>   &lt;meta charset=&quot;UTF-8&quot;&gt;<br>   &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;<br>   &lt;title&gt;More Details&lt;/title&gt;<br>   &lt;link rel=&quot;stylesheet&quot; href=&quot;css/style.css&quot;&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>   &lt;?php<br>      if(isset($_GET[&quot;id&quot;])) {<br>         $id = $_GET[&quot;id&quot;];<br>         include &quot;config.php&quot;;<br><br>         $sql = &quot;SELECT * FROM students WHERE id=$id&quot;;<br>         $result = mysqli_query($conn, $sql);<br>         $row = mysqli_fetch_assoc($result);<br><br>         ?&gt;<br>            &lt;div class=&quot;formview&quot;&gt;<br><br>               &lt;div class=&quot;list&quot;&gt;<br>                  &lt;h2&gt;Full Name&lt;/h2&gt;<br>                  &lt;p&gt;&lt;?php echo $row[&quot;name&quot;]; ?&gt;&lt;/p&gt;<br>               &lt;/div&gt;<br><br>               &lt;div class=&quot;list&quot;&gt;<br>                  &lt;h2&gt;Mobile Number&lt;/h2&gt;<br>                  &lt;p&gt;&lt;?php echo $row[&quot;phone&quot;]; ?&gt;&lt;/p&gt;<br>               &lt;/div&gt;<br><br>               &lt;div class=&quot;list&quot;&gt;<br>                  &lt;h2&gt;Age&lt;/h2&gt;<br>                  &lt;p&gt;&lt;?php echo $row[&quot;age&quot;]; ?&gt;&lt;/p&gt;<br>               &lt;/div&gt;<br><br>               &lt;div class=&quot;list&quot;&gt;<br>                  &lt;h2&gt;Gender&lt;/h2&gt;<br>                  &lt;p&gt;&lt;?php echo $row[&quot;gender&quot;]; ?&gt;&lt;/p&gt;<br>               &lt;/div&gt;<br><br>               &lt;div class=&quot;list&quot;&gt;<br>                  &lt;h2&gt;Faculty&lt;/h2&gt;<br>                  &lt;p&gt;&lt;?php echo $row[&quot;faculty&quot;]; ?&gt;&lt;/p&gt;<br>               &lt;/div&gt;<br><br>            &lt;/div&gt;<br>         &lt;?php<br>      }<br>   ?&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*OTGzuaQl2sVUVIMPvHQrDA.png" /></figure><p>This PHP page displays the detailed information of a student record based on the provided “id” parameter. It retrieves the record from the database using the “config.php” file, and the information is displayed in a structured format using HTML elements.</p><p><strong>Now let’s create a “delete.php” file, Here is the code.</strong></p><pre>// delete.php<br><br>&lt;?php<br><br>   include &quot;config.php&quot;;<br>   $id = $_GET[&#39;id&#39;];<br>   $sql = &quot;DELETE FROM students WHERE id=$id&quot;;<br>   $result = mysqli_query($conn, $sql);<br><br>   if($result) {<br>     header(&#39;location:view.php&#39;);<br>   }<br>   else {<br>        die(mysqli_error($conn));<br>   }<br>?&gt;</pre><p>This code deletes a specific student record from the database table based on the provided “id” parameter. After the deletion, it redirects the user to the “view.php” page to display the updated student records.</p><p><strong>Now let’s create a “search.php” file, Here is the code.</strong></p><pre>// search.php<br><br>&lt;?php<br>   include &#39;config.php&#39;;<br>?&gt;<br><br>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>&lt;head&gt;<br>   &lt;meta charset=&quot;UTF-8&quot;&gt;<br>   &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;<br>   &lt;title&gt;Student Record data Search&lt;/title&gt;<br>   &lt;style&gt;<br>      body {<br>         background-color: #1f242d;<br>         color: #a7a0a0;<br>      }<br>      <br>      table tr {<br>         text-align: center;<br>      }<br>   &lt;/style&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>   &lt;table border=&quot;1&quot; width=&quot;100%&quot;&gt;<br>      &lt;?php<br>         if(isset($_POST[&#39;submit&#39;])) {<br>            $search = $_POST[&#39;search&#39;];<br><br>            $sql = &quot;SELECT * FROM students WHERE id LIKE &#39;$search&#39; or name LIKE &#39;%$search%&#39;&quot;;<br>            $result = mysqli_query($conn, $sql);<br><br>            if($result) {<br>               if(mysqli_num_rows($result) &gt; 0) {<br>                  echo &#39;&lt;thead&gt;<br>                    &lt;tr&gt;<br>                    &lt;th&gt;ID&lt;/th&gt;<br>                    &lt;th&gt;Full Name&lt;/th&gt;<br>                    &lt;/tr&gt;&lt;/thead&gt;&#39;;<br><br>                  while($row = mysqli_fetch_assoc($result)) {<br>                     echo &#39;&lt;tbody&gt;<br>                    &lt;tr&gt;<br>                    &lt;td&gt;&lt;a href=&quot;search.details.php?data=&#39;.$row[&#39;id&#39;].&#39;&quot;&gt;&#39;.$row[&#39;id&#39;].&#39;&lt;/a&gt;&lt;/td&gt;<br>                    &lt;td&gt;&#39;.$row[&#39;name&#39;].&#39;&lt;/td&gt;<br>                    &lt;/tr&gt;&lt;/tbody&gt;&#39;;<br>                  }<br>               }<br>               else {<br>                  echo &#39;&lt;h2&gt;Data not found&lt;/h2&gt;&#39;;<br>               }<br>            }<br>         }<br>      ?&gt;<br>   &lt;/table&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>This code allows users to search for student records based on their ID or name. The matching records are displayed in a table, and each ID is linked to a separate page for detailed information. If no matching records are found, a message is displayed.</p><p>The ID is wrapped in an anchor tag &lt;a&gt; that links to a separate page called “search.details.php” and passes the ID as a parameter in the URL.</p><p><strong>Now let’s create a “search.details.php” file, Here is the code.</strong></p><pre>// search.details.php<br><br>&lt;?php <br>   include &#39;config.php&#39;;<br>?&gt;<br><br>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>&lt;head&gt;<br>   &lt;meta charset=&quot;UTF-8&quot;&gt;<br>   &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;<br>   &lt;title&gt;Student Record data Search Details&lt;/title&gt;<br>   &lt;link rel=&quot;stylesheet&quot; href=&quot;css/style.css&quot;&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>   &lt;?php<br>      $data = $_GET[&#39;data&#39;];<br>      $sql = &quot;SELECT * FROM students WHERE id=$data&quot;;<br>      $result = mysqli_query($conn, $sql);<br><br>      if($result) {<br>         $row = mysqli_fetch_assoc($result);<br><br>         echo &#39;&lt;div class=&quot;formview&quot;&gt;<br>            &lt;div class=&quot;list&quot;&gt;<br>               &lt;h2&gt;Full Name&lt;/h2&gt;<br>               &lt;p&gt;&#39;.$row[&#39;name&#39;].&#39;&lt;/p&gt;<br>            &lt;/div&gt;<br><br>            &lt;div class=&quot;list&quot;&gt;<br>               &lt;h2&gt;Mobile Number&lt;/h2&gt;<br>               &lt;p&gt;&#39;.$row[&#39;phone&#39;].&#39;&lt;/p&gt;<br>            &lt;/div&gt;<br><br>            &lt;div class=&quot;list&quot;&gt;<br>               &lt;h2&gt;Age&lt;/h2&gt;<br>               &lt;p&gt;&#39;.$row[&#39;age&#39;].&#39;&lt;/p&gt;<br>            &lt;/div&gt;<br><br>            &lt;div class=&quot;list&quot;&gt;<br>               &lt;h2&gt;Gender&lt;/h2&gt;<br>               &lt;p&gt;&#39;.$row[&#39;gender&#39;].&#39;&lt;/p&gt;<br>            &lt;/div&gt;<br><br>            &lt;div class=&quot;list&quot;&gt;<br>               &lt;h2&gt;Faculty&lt;/h2&gt;<br>               &lt;p&gt;&#39;.$row[&#39;faculty&#39;].&#39;&lt;/p&gt;<br>            &lt;/div&gt;<br>         &lt;/div&gt;&#39;;<br>      }<br>   ?&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>This code retrieves the details of a specific student record based on the ID passed through the URL parameter. It displays the student’s full name, mobile number, age, gender, and faculty in a formatted view. The code assumes that the “config.php” file is properly configured to establish the database connection.</p><p><strong>Now let’s create CSS files,</strong></p><p>This<strong> “style.css” </strong>file linked the<strong> “create.php”, “update.php”, “read.php” and “search.details.php”</strong></p><pre>/* style.css */<br><br>@import url(https://medium.com/&#39;https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;1,100;1,200;1,300&amp;display=swap&#39;);<br><br>* {<br>    margin: 0;<br>    padding: 0;<br>    font-family: &#39;poppins&#39;, sans-serif;<br>    box-sizing: border-box;<br>    text-decoration: none;<br>    list-style: none;<br>    scroll-behavior: smooth;<br>}<br><br>body {<br>   background-color: #1f242d;<br>   color: #fff;<br>}<br><br>section{<br>   margin-bottom: 5rem;<br>}<br><br>section h1 {<br>   text-align: center;<br>   letter-spacing: 3px;<br>   font-size: 2.5rem;<br>   font-weight: bold;<br>   color: #a7a0a0;<br>   text-shadow: 2px 2px 2px #ddd;<br>   margin-bottom: 2rem;<br>}<br><br>section form {<br>   position: relative;<br>   max-width: 800px;<br>   width: 100%;<br>   margin: auto;<br>   padding: 25px;<br>   font-size: 20px;<br>   letter-spacing: 2px;<br>   background-color: #fff;<br>   color: #282d33;<br>   border-radius: 8px;<br>   box-shadow: 0 0 15px #1f242d;<br>}<br><br>section form .inputbox {<br>   width: 100%;<br>   margin-top: 20px;<br>}<br><br>section form .inputbox label {<br>   color: #282d33;<br>}<br><br>section form .inputbox input,<br>section form .inputbox select {<br>   position: relative;<br>   height: 50px;<br>   width: 100%;<br>   outline: none;<br>   font-size: 1rem;<br>   color: #282d33;<br>   margin-top: 8px;<br>   border: 1px solid #ddd;<br>   border-radius: 6px;<br>   padding: 0 15px;<br>}<br><br>section form .inputbox .formbtn {<br>   background: #a7a0a0;<br>   color: #1f242d;<br>   font-weight: 900;<br>   letter-spacing: 2px;<br>   transition: all .45s ease;<br>}<br><br>section form .inputbox .formbtn:hover {<br>   transform: scale(0.9);<br>   cursor: pointer;<br>}<br><br>.formview {<br>   text-align: center;<br>   letter-spacing: 2px;<br>   background-color: #ddd;<br>   color: #282d33;<br>   max-width: 800px;<br>   margin: 10rem auto 5rem;<br>   border-radius: 8px;<br>   box-shadow: 0 0 15px #1f242d;<br>}<br><br>.formview .list {<br>   display: block;<br>   padding: 20px;<br>}</pre><p>This <strong>“view.css</strong>” file is linked to the <strong>“view.php”</strong></p><pre>/* view.css */<br><br>@import url(https://medium.com/&#39;https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;1,100;1,200;1,300&amp;display=swap&#39;);<br><br>* {<br>    margin: 0;<br>    padding: 0;<br>    font-family: &#39;poppins&#39;, sans-serif;<br>    box-sizing: border-box;<br>    text-decoration: none;<br>    list-style: none;<br>    scroll-behavior: smooth;<br>}<br><br>body {<br>   background-color: #1f242d;<br>   color: #fff;<br>}<br><br>section{<br>   margin-bottom: 5rem;<br>}<br><br>section .tableviewhead {<br>   display: flex;<br>   align-items: center;<br>   justify-content: space-around;<br>   margin-bottom: 4rem;<br>}<br><br>section .tableviewhead h1 {<br>   letter-spacing: 3px;<br>   font-size: 2.5rem;<br>   font-weight: bold;<br>   color: #a7a0a0;<br>   text-shadow: 2px 2px 2px #ddd;<br>}<br><br>section .tableviewhead .left{<br>   display: flex;<br>}<br><br>section .tableviewhead .left form {<br>   margin-right: 20px;<br>}<br><br>section .tableviewhead .left form input,<br>section .tableviewhead .left form button {<br>   position: relative;<br>   height: 30px;<br>   font-size: 1rem;<br>  color: #282d33;<br>  outline: none;<br>  border: 1px solid #ddd;<br>  border-radius: 6px;<br>  padding: 0 15px;<br>}<br><br>section .tableviewhead .left a {<br>   background-color: #fff;<br>   color: #282d33;<br>   padding: 10px 24px;<br>   border-radius: 5px;<br>   margin-left: 20px;<br>   transition: all .45s ease;<br>}<br><br>section .tableviewhead a:hover {<br>   background-color: #282d33;<br>   color: #ddd;<br>   transform: scale(0.9);<br>}<br><br>table {<br>   width: 100%;<br>   text-align: center;<br>}<br><br>table thead {<br>   background: #eee;<br>   color: #1f242d;<br>}<br><br>table th {<br>   font-size: 1.5rem;<br>   padding: 1rem;<br>}<br><br>table tbody td {<br>   font-size: 1.4rem;<br>   padding: 1rem;<br>   border-bottom: 2px solid #a7a0a0;<br>}<br><br>tbody tr td a {<br>   display: flex;<br>   align-items: center;<br>   justify-content: center;<br>}<br><br>tbody tr td .read {<br>   background-color: #643ce7;<br>   padding: 5px 4px;<br>   border-radius: 5px;<br>   margin: 10px auto;<br>   color: #1f242d;<br>   transition: all .45s ease;<br>}<br><br>tbody tr td .update {<br>   background-color: #27ae60;<br>   padding: 5px 4px;<br>   border-radius: 6px;<br>   margin: 10px auto;<br>   color: #1f242d;<br>   transition: all .45s ease;<br>}<br><br>tbody tr td .delete {<br>   background-color: crimson;<br>   padding: 5px 4px;<br>   border-radius: 6px;<br>   margin: 10px auto;<br>   color: #1f242d;<br>   transition: all .45s ease;<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8d317e029849" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Simple Image Slider in HTML, CSS and JavaScript]]></title>
            <link>https://medium.com/@ramindunimesh61/a-simple-image-slider-in-html-css-and-javascript-d5bf77f9fd11?source=rss-b3e987517295------2</link>
            <guid isPermaLink="false">https://medium.com/p/d5bf77f9fd11</guid>
            <category><![CDATA[css]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[image-slider]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Ramindu Nimesh]]></dc:creator>
            <pubDate>Sun, 09 Jul 2023 17:35:32 GMT</pubDate>
            <atom:updated>2023-07-10T04:11:12.831Z</atom:updated>
            <content:encoded><![CDATA[<p>This Slider allows the user to navigate between slides using radio or Arrow buttons manually. It also provides an automatic slide show functionality that transitions between slides after a specified time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FN21MLoeiVH-xTqysa5GKg.png" /><figcaption>In this article, we will create an image slider that looks like this from scratch.</figcaption></figure><p>The source code can be accessed <a href="https://github.com/ramindu-Nimex/My_Blogs/tree/main/image%20slider">here</a>.</p><p>First things first, go ahead and set up a new folder. I’m gonna call it “IMAGE SLIDER” but you can call yours whatever you want. Next add 3 more folders to that one called “js”, “css”, and “image”.</p><p>Go ahead and open that folder in the text editor of your choice, I use Visual Studio and make a new file called index.html at the root of your project. next, create a “style.css” file in the CSS folder and a “script.js” file in the js folder.</p><p>Now, you should have a project that looks something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/167/1*YOLs0R9kk2aJUxfnDoaxLg.png" /></figure><p>Now, go ahead and add your images to the image folder, it doesn’t matter how many, what size, or what format, but the naming is very important.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/227/1*KW24mHd-mb31SCQMRH9sog.png" /></figure><p><strong>let’s dive into the HTML structure of this simple slider:</strong></p><pre><br>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>&lt;head&gt;<br>   &lt;meta charset=&quot;UTF-8&quot;&gt;<br>   &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;<br>   &lt;title&gt;Image Slider&lt;/title&gt;<br>   &lt;link rel=&quot;stylesheet&quot; href=&quot;./css/style.css&quot;&gt;<br>   &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css&quot; <br>   integrity=&quot;sha512-iecdLmaskl7CVkqkXNQ/ZH/XLlvWZOJyj7Yy7tcenmpD1ypASozpmT/E0iPtmFIB46ZmdtAc9eNBvH0H/ZpiBw==&quot; <br>   crossorigin=&quot;anonymous&quot; referrerpolicy=&quot;no-referrer&quot; /&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>   <br>   &lt;div class=&quot;slider&quot;&gt;<br>      &lt;input type=&quot;radio&quot; name=&quot;sld&quot; id=&quot;slide1&quot;&gt;<br>      &lt;input type=&quot;radio&quot; name=&quot;sld&quot; id=&quot;slide2&quot;&gt;<br>      &lt;input type=&quot;radio&quot; name=&quot;sld&quot; id=&quot;slide3&quot;&gt;<br>      &lt;input type=&quot;radio&quot; name=&quot;sld&quot; id=&quot;slide4&quot;&gt;<br>      &lt;input type=&quot;radio&quot; name=&quot;sld&quot; id=&quot;slide5&quot;&gt;<br><br>      &lt;!-- slides --&gt;<br>      &lt;div class=&quot;slides&quot;&gt;<br>          &lt;div class=&quot;slide sli&quot;&gt;<br>              &lt;img src=&quot;image/image1.jpg&quot; alt=&quot;slide1&quot;&gt;<br>          &lt;/div&gt;<br><br>          &lt;div class=&quot;slide&quot;&gt;<br>              &lt;img src=&quot;image/image2.jpg&quot; alt=&quot;slide2&quot;&gt;<br>          &lt;/div&gt;<br><br>          &lt;div class=&quot;slide&quot;&gt;<br>              &lt;img src=&quot;image/image3.jpg&quot; alt=&quot;slide3&quot;&gt;<br>          &lt;/div&gt;<br><br>          &lt;div class=&quot;slide&quot;&gt;<br>              &lt;img src=&quot;image/image4.jpg&quot; alt=&quot;slide4&quot;&gt;<br>          &lt;/div&gt;<br><br>          &lt;div class=&quot;slide&quot;&gt;<br>              &lt;img src=&quot;image/image5.jpg&quot; alt=&quot;slide5&quot;&gt;<br>          &lt;/div&gt;<br>      &lt;/div&gt;<br><br>      &lt;a href=&quot;#&quot; class=&quot;arrow left&quot;&gt;&lt;i class=&quot;fas fa-arrow-circle-left&quot;&gt;&lt;/i&gt;&lt;/a&gt;<br>      &lt;a href=&quot;#&quot; class=&quot;arrow right&quot;&gt;&lt;i class=&quot;fas fa-arrow-circle-right&quot;&gt;&lt;/i&gt;&lt;/a&gt;<br><br>      &lt;div class=&quot;radio&quot;&gt;<br>          &lt;label for=&quot;slide1&quot; class=&quot;radbtn active&quot;&gt;&lt;/label&gt;<br>          &lt;label for=&quot;slide2&quot; class=&quot;radbtn&quot;&gt;&lt;/label&gt;<br>          &lt;label for=&quot;slide3&quot; class=&quot;radbtn&quot;&gt;&lt;/label&gt;<br>          &lt;label for=&quot;slide4&quot; class=&quot;radbtn&quot;&gt;&lt;/label&gt;<br>          &lt;label for=&quot;slide5&quot; class=&quot;radbtn&quot;&gt;&lt;/label&gt;<br>      &lt;/div&gt;<br>  &lt;/div&gt;<br><br>  &lt;script src=&quot;./js/script.js&quot;&gt;&lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;<br><br><br><br></pre><p>This HTML code creates a basic image slider with navigation arrows and radio buttons for controlling the slides. The associated CSS and JavaScript files are referenced to provide the styling and interactivity of the slider.</p><p>Here’s an explanation of the code:</p><p><strong>1. The document structure:</strong></p><p><em>The “&lt;html&gt;” tag is the root element. The “&lt;head&gt;” section contains meta information and external CSS and font-awesome library references. The “&lt;body&gt;” section contains the content of the webpage.</em></p><p><strong>2. Image Slider:</strong></p><p><em>The image slider is created using a “&lt;div&gt;” element with the class “slider”. It contains a set of radio buttons (&lt;input type=” radio”&gt;) to control the slides. Each radio button has a unique ID (“slide1”, “slide2”, etc.) and is associated with a specific slide.</em></p><p><strong>3. Slides:</strong></p><p><em>The slides are wrapped in a “&lt;div&gt;” element with the class “slides”. Each slide is represented by a “&lt;div&gt;” element with the class “slide”. Inside each slide, an “&lt;img&gt;” tag is used to display an image. The “src” attribute specifies the path to the image file, and the “alt” attribute provides alternative text for the image.</em></p><p><strong>4. Navigation:</strong></p><p><em>Navigation arrows are included as “&lt;a&gt;” tags with the classes “left” and “right”. The left arrow contains a font-awesome icon for the left arrow. The right arrow contains a font-awesome icon for the right arrow.</em></p><p><strong>5. Radio Buttons:</strong></p><p><em>The radio buttons are represented by “&lt;label&gt;” tags with the class “radbtn”. Each “&lt;label&gt;” tag is associated with a specific radio button using the “for” attribute.</em></p><p><strong>6. JavaScript Tag:</strong></p><p><em>The script tag “&lt;script src=”./js/script.js”&gt;&lt;/script&gt;” references an external JavaScript file named “script.js”. This file likely contains the logic for controlling the image slider functionality.</em></p><p><strong>Next, we have the CSS, which is central to this front-end project:</strong></p><pre>/* slider */<br>input[type=&quot;radio&quot;]{<br>   display: none;<br>}<br><br>.slider {<br>   width: 100%;<br>   height: 100vh;<br>   background-color: #1f242d;<br>   color: #fff;<br>}<br><br>.slider .slides {<br>   position: relative;<br>   width: 100%;<br>   height: 100%;<br>   display: flex;<br>   overflow: hidden;<br>}<br><br>.slider .slides .slide {<br>   position: absolute;<br>   width: 100%;<br>   height: 100%;<br>   opacity: 0;<br>   display: flex;<br>   transition: all 0.5s ease-in;<br>}<br><br>.slider .slide .sli {<br>   opacity: 1;<br>}<br><br>.slider .slides .slide::after {<br>   position: absolute;<br>   content: &#39;&#39;;<br>   top: 0;<br>   left: 0;<br>   width: 100%;<br>   height: 100%;<br>   background-color: #000;<br>   opacity: 0.1;<br>   z-index: 1;<br>}<br><br>.slider .slide img {<br>   min-width: 70%;<br>   min-height: 70%;<br>   object-fit: cover;<br>   transform: scale(1);<br>   transition: all 0.5 ease-in;<br>   margin: 10rem 14rem;<br>}<br><br>.slider .arrow {<br>   position: absolute;<br>   text-decoration: none;<br>   z-index: 10;<br>   color: #fff;<br>   top: 50%;<br>   transform: translateY(-50%);<br>   opacity: 0.5;<br>   transition: all 0.3 ease-in;<br>}<br><br>.slider .arrow:hover {<br>   opacity: 1;<br>}<br><br>.slider .arrow i {<br>   font-size: 3rem;<br>}<br><br>.slider .left {<br>   left: 70px;<br>}<br><br>.slider .right {<br>   right: 70px;<br>}<br><br>.slider .radio {<br>   width: 100%;<br>   position: absolute;<br>   bottom: 20px;<br>   z-index: 5;<br>   display: flex;<br>   justify-content: center;<br>   align-items: center;<br>}<br><br>.slider .radio .radbtn {<br>   width: 16px;<br>   height: 16px;<br>   border: 2px solid #fff;<br>   border-radius: 50%;<br>   margin: 0 5px;<br>   cursor: pointer;<br>   transition: all 0.3s ease-in;<br>}<br><br>.slider .radio .radbtn:hover {<br>   background-color: #fff;<br>   border-radius: 30%;<br>}<br><br>.active{<br>   background-color: #fff;<br>}<br><br><br><br></pre><p>This CSS code provides the necessary styles to create an attractive and functional image slider with navigation arrows and radio buttons for controlling the slides.</p><p><strong>1. Styling for radio buttons:</strong></p><p><em>The ‘input[type=” radio”]’ selector hides the radio buttons using “display: none;”.</em></p><p><strong>2. Styling for the slider container:</strong></p><p><em>The “.slider” class sets the width and height to 100% of the viewport (100vh). The background colour is set to “#1f242d” (a dark shade of blue). The text colour is set to white (#fff).</em></p><p><strong>3. Styling for the slides container:</strong></p><p><em>The “.slider .slides” class sets the slides container to a relative position and sets its width and height to 100%. The container uses flexbox (display: flex;) for slide alignment. The “overflow” property is set to hidden to hide any overflow content.</em></p><p><strong>4. Styling for individual slides:</strong></p><p><em>The “.slider .slides .slide” class sets each slide to an absolute position within the container. The width and height are set to 100%. The initial opacity is set to 0 to hide the slides. The “transition” property is used to create a smooth transition effect with a duration of 0.5 seconds.</em></p><p><strong>5. Styling for active slide:</strong></p><p><em>The “.slider .slide .sli” class sets the opacity of the active slide to 1, making it visible.</em></p><p><strong>6. Styling for slide overlay:</strong></p><p><em>The “.slider .slides .slide::after” pseudo-element creates an overlay effect. It is positioned absolutely at the top-left corner, covering the entire slide. The background colour is set to black (#000). The opacity is set to 0.1 to create a semi-transparent effect. The “z-index” property is set to 1 to ensure it appears below the slide content.</em></p><p><strong>7. Styling for slide images:</strong></p><p><em>The “.slider .slide img” class sets the minimum width and height of the slide images to 70%. The “object-fit” property is set to cover to ensure the image fills the container while maintaining its aspect ratio. The “transform” and “transition” properties are used for scaling and creating a smooth transition effect. The “margin” property is set to create spacing around the images.</em></p><p><strong>8. Styling for navigation arrows:</strong></p><p><em>The “.slider .arrow” class styles the navigation arrows. The position is set to absolute, and the “top” and “transform” properties are used for vertical centring. The initial opacity is set to 0.5, and the “transition” property is used to create a smooth transition effect. The “:hover” pseudo-class is used to change the opacity to 1 on hover. The font-awesome icons are styled using the “.slider .arrow I” selector.</em></p><p><strong>9. Styling for left and right arrows:</strong></p><p><em>The “.slider .left” and “.slider .right” classes position the arrows on the left and right sides, respectively.</em></p><p><strong>10. Styling for radio buttons:</strong></p><p><em>The “.slider .radio” class positions the radio buttons at the bottom of the slider container. It uses flexbox for centering (display: flex; justify-content: center; align-items: center;). The “.slider .radio .radbtn” class styles the individual radio buttons. The width and height are set to create circular buttons with a white border. The “margin” property creates spacing between the buttons. The “cursor” property sets the cursor to a pointer on hover. The “transition” property creates a smooth transition effect on hover. The “.slider .radio .radbtn:hover” class changes the background colour and border radius on hover. The “.active” class is used to highlight the active radio button by changing its background colour.</em></p><p><strong>Lastly, we will look at JavaScript. The JavaScript code you provided is responsible for the functionality of the image slider.</strong></p><pre>//slider<br>// create variable<br><br>var slide = document.querySelectorAll(&#39;.slide&#39;);<br>var radiobtn = document.querySelectorAll(&#39;.radbtn&#39;);<br>var leftArrow = document.querySelector(&#39;.left&#39;);<br>var rightArrow = document.querySelector(&#39;.right&#39;);<br>var slideInt;<br>var intTime = 5000; // 5s(5000ms)<br><br>//iterate all radio btn<br>radiobtn.forEach(function(item, index) {<br>    item.addEventListener(&#39;click&#39;, function() {<br>        manButtonNav(index);<br>    });<br>});<br><br>rightArrow.addEventListener(&#39;click&#39;, function(e) {<br>    e.preventDefault();<br>    nextSlide();<br>    clrInterval();<br>});<br><br>leftArrow.addEventListener(&#39;click&#39;, function(e) {<br>    e.preventDefault();<br>    prevSlide();<br>    clrInterval();<br>});<br><br>function manButtonNav(index) {<br>    for(var i = 0; i &lt; slide.length; i++) {<br>        if(i !== index) {<br>            slide[i].classList.remove(&#39;sli&#39;);<br>            radiobtn[i].classList.remove(&#39;active&#39;);<br>        }<br>        else {<br>            slide[index].classList.add(&#39;sli&#39;);<br>            radiobtn[index].classList.add(&#39;active&#39;);<br>        }<br>    }<br>    clrInterval();<br>}<br><br>//next slide function<br>function nextSlide() {<br>    var sli = document.querySelector(&#39;.sli&#39;);<br>    var active = document.querySelector(&#39;.active&#39;);<br><br>    //unset current slide and radio btn<br>    sli.classList.remove(&#39;sli&#39;);<br>    active.classList.remove(&#39;active&#39;);<br><br>    //set next slide and radio btn<br>    if(sli.nextElementSibling) {<br>        sli.nextElementSibling.classList.add(&#39;sli&#39;);<br>        active.nextElementSibling.classList.add(&#39;active&#39;);<br>    }<br>    else {<br>        slide[0].classList.add(&#39;sli&#39;);<br>        radiobtn[0].classList.add(&#39;active&#39;);<br>    }<br>}<br><br>//previous slide function<br>function prevSlide() {<br>    var sli = document.querySelector(&#39;.sli&#39;);<br>    var active = document.querySelector(&#39;.active&#39;);<br><br>    //unset current slide and radio btn<br>    sli.classList.remove(&#39;sli&#39;);<br>    active.classList.remove(&#39;active&#39;);<br><br>    //set next slide and radio btn<br>    if(sli.previousElementSibling) {<br>        sli.previousElementSibling.classList.add(&#39;sli&#39;);<br>        active.previousElementSibling.classList.add(&#39;active&#39;);<br>    }<br>    else {<br>        jeepslide[slide.length - 1].classList.add(&#39;sli&#39;);<br>        radiobtn[radiobtn.length - 1].classList.add(&#39;active&#39;);<br>    }<br>}<br><br>function clrInterval() {<br>    clearInterval(slideInt);<br>    slideInt = setInterval(nextSlide, intTime);<br>}<br><br>slideInt = setInterval(nextSlide, intTime);<br><br><br><br></pre><p>This JavaScript code provides the necessary functionality to manually navigate between slides using radio or arrow buttons. It also includes an automatic slide transition feature.</p><p><strong>1. Variable Declarations:</strong></p><p><em>The “slide” variable stores an array of all slide elements. The “radiobtn” variable stores an array of all radio button elements. The “leftArrow” variable stores a reference to the left arrow element. The “rightArrow” variable stores a reference to the right arrow element. The “slideInt” variable stores the interval ID for the slide interval. The “intTime” variable stores the duration of each slide in milliseconds.</em></p><p><strong>2. Radio Button Event Listeners:</strong></p><p><em>The code iterates through each radio button using the “forEach” method. An event listener is added to each radio button, triggering the “manButtonNav” function when clicked. The “manButtonNav” function is responsible for handling the navigation when a radio button is clicked.</em></p><p><strong>3. Arrow Button Event Listeners:</strong></p><p><em>Event listeners are added to the left and right arrow buttons. When clicked, the “nextSlide” or “prevSlide” function is called, respectively. The “clrInterval” function is also called to clear the slide interval and restart it.</em></p><p><strong>4. “manButtonNav” Function:</strong></p><p><em>This function handles the navigation when a radio button is clicked. It iterates through all the slides and radio buttons. If the current index does not match the clicked index, the corresponding slide and radio button are removed from the “active” state. If the current index matches the clicked index, the corresponding slide and radio button are added to the “active” state. The “clrInterval” function is called to clear the slide interval and restart it.</em></p><p><strong>5. “nextSlide” Function:</strong></p><p><em>This function handles the transition to the next slide. It gets the current slide and active radio button using “querySelector”. The current slide and active radio button are removed from the “sli” and “active” states. If there is a next sibling slide, if so, it adds the appropriate classes to the next slide and radio buttons. If there is no next sibling slide, it selects the first slide and radio button to create a loop effects.</em></p><p><strong>6. “prevSlide” Function:</strong></p><p><em>This function handles the transition to the previous slide. It follows a similar logic to the nextSlide function but handles the previous sibling slide instead.</em></p><p><strong>7. “clrInterval” Function:</strong></p><p><em>This function clears the slide interval using “clearInterval”. It is called before navigating to the next or previous slide to ensure smooth manual navigation. After clearing the interval, it sets a new interval using “setInterval” and the “nextSlide” function.</em></p><p><strong>8. Initial Slide Interval:</strong></p><p><em>The slide interval is initially set using “setInterval” and the “nextSlide” function. This starts the automatic transition between slides based on the specified “intTime” duration.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d5bf77f9fd11" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>