Designing a Website Using Xampp For Windows


What is Xampp

Xampp For WIndows and other operating system (Cross -platform, Apache, MySql, Php, Perl) is an open-source web-server package which was devoloped by Apache-Friends which interpretes scripts written in Php and Perl Programming Languages. Xampp developement was made easy to install quickly on any operating system.


How Does Xampp Work

question

Xampp helps a user to test his/her website on localhost or on a server using computers and laptops before realeasing it to the main server. Xampp helps user test their website in a suitable Environment and verify the working of projects based on Apache, Mysql Database, Pearl, Php through the system of host.

 

How to install Xampp For Windows

 

  • Download Xampp from their official website
  • After Dowloading Run setup.exe file.
  • Follow all instructions and give all permission to the software.
  • After installation is complete, open xampp control panel
  • Turn on Apache and Mysql
  • Close Xampp control panel

Testing Xampp For Windows

To test it Navigate to any of your browsers and type in the link tab localhost.

You will be presented with the localhost dashboard

xampp dashboard

  • Click phpMyAdmin to enter php database.

php


  • Create a new database then name it testing.
  • After you have created a new database, create a table called test.

php table

  • Fill in the following fields as

fill in tables

  • First row/column: id, then tick the A.I box.
  • Second row/column: name, Varchar and 100.

Then click save.

Thats it for the database.

  • Navigate to the xampp folder
  • open htdocs folder.
  • Right click and create a new folder called Test.
  • Then open the folder in your favorite text editor.
  • Create a new file called index.php
  • Use the abrreviation html:5 then click enter.

 

<!DOCTYPE html>
<html lang=”en”>
<head>
    <meta charset=”UTF-8″>
    <meta http-equiv=”X-UA-Compatible” content=”IE=edge”>
    <meta name=”viewport” content=”width=device-width, initial-scale=1.0″>
    <title>Test</title>
</head>
<body>
<form method=”POST” action=”index.php”>
    <input type =”text” name=”name”>
    <input type =”Submit” name=”submit”>
    <form>
    <br>
    <?php
$db = mysqli_connect(“localhost”, “root”, “”, “testing”);
if(!$db)
{
   die(“Connection Failed: ” .mysqli_connect_error());
}
if (isset($_POST[‘submit’])){
    $name = $_POST[‘name’];
    $sql = “INSERT INTO test (name) VALUES (‘$name’)”;
    $result =$db->query($sql);
}
$record =mysqli_query($db, “SELECT * FROM test ORDER BY id DESC”);
while($data = mysqli_fetch_array($record))
{
?>
 <?php
  echo “Your Name is “. $data[‘name’]; ?>
    <?php
}
?>
</body>
</html>
  • Copy and paste the following code to display a name written by a user.
0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply