Showing posts with label HTML. Show all posts
Showing posts with label HTML. Show all posts

Tuesday, July 2, 2024

Easy Accordion with Plus/Minus Icons

 <!doctype HTML>

<html>

<head>

<meta content="text/html; charset=UTF-8" />

<title>Web Code Addict Accordion</title>

</head>

<body>

<div class="accordion_container">

    <div class="accordion_heading">First Accordian Head<span class="plusminus">+</span>


    </div>

    <div class="accordion_content" style="display: none;">

        <p>First Accordian Body, it will have description</p>

    </div>

    <div class="accordion_heading">Second Accordian Head<span class="plusminus">+</span>


    </div>

    <div class="accordion_content" style="display: none;">

        <p>Second Accordian Body, it will have description</p>

    </div>

    <div class="accordion_heading">Third Accordian Head<span class="plusminus">+</span>


    </div>

    <div class="accordion_content" style="display: none;">

        <p>Third Accordian Body, it will have description</p>

    </div>

</div>

</body>

</html>


/////////////////////////////////CSS///////////////////////////////////////////////////

.accordion_container {

    width: 500px;

}

.accordion_heading {

    background-color:skyblue;

    color: white;

    cursor: pointer;

    font-family: arial;

    font-size: 14px;

    margin: 0 0 1px 0;

    padding: 7px 11px;

    font-weight: bold;

}

.accordion_content {

    background: lightgray;

}

.accordion_content p {

    padding: 18px 5px;

    margin: 0px;

}

.plusminus {

    float:right;

}

/////////////////////////////////////////////Script/////////////////////////////

$(document).ready(function () {

  $(".accordion_heading").click(function () {

        if ($('.accordion_content').is(':visible')) {

            $(".accordion_content").slideUp(300);

            $(".plusminus").text('+');

        }

        if ($(this).next(".accordion_content").is(':visible')) {

            $(this).next(".accordion_content").slideUp(300);

            $(this).children(".plusminus").text('+');

        } else {

            $(this).next(".accordion_content").slideDown(300);

            $(this).children(".plusminus").text('-');

        }

    });

});

Saturday, April 8, 2023

What PHP is?

 


PHP stands for Hypertext Preprocessor. PHP is a powerful and widely-used open source server-side scripting language to write dynamically generated web pages. PHP scripts are executed on the server and the result is sent to the browser as plain HTML.


 PHP can be integrated with the number of popular databases, including MySQL, PostgreSQL, Oracle, Sybase, Informix, and Microsoft SQL Server.

PHP can be embedded within a normal HTML web pages. That means inside your HTML documents you'll have PHP statements like this:



Example:

<!DOCTYPE HTML>
<html>
<head>
    <title>PHP Application</title>
</head>
<body>
<?php
// Display greeting message
echo 'Hello World!';
?>
</body>
</html>



 What You Can Do with PHP 


There are lot more things you can do with PHP. 

  •  You can generate dynamic pages and files. 
  • You can create, open, read, write and close files on the server. 
  • You can collect data from a web form such as user information, email, credit card information and much more. 
  • You can send emails to the users of your website. 
  • You can send and receive cookies to track the visitor of your website.
  •  You can store, delete, and modify information in your database. 
  • You can restrict unauthorized access to your website. 
  • You can encrypt data for safe transmission over internet.

Monday, April 3, 2023

Data Insertion in MYSQL

 To insert data into a MySQL table, you would need to use the SQL INSERT INTO command. 

You can insert data into the MySQL table by using the mysql> prompt or by using any script like PHP.



Here are some syntax rules to follow:

  •  The SQL query must be quoted in PHP 
  • String values inside the SQL query must be quoted
  •  Numeric values must not be quoted
  •  The word NULL must not be quoted
Syntax

INSERT INTO `table_name`(column_1,column_2,...) VALUES (value_1,value_2,...);
  • INSERT INTO `table_name` is the command that tells MySQL server to add new row into a table named `table_name`.
  • (column_1,column_2,...) specifies the columns to be updated in the  new row
  • VALUES (value_1,value_2,...) specifies the values to be added into the new row
  • String data types - all the string values should be enclosed in single quotes.
  • Numeric data types - all numeric values should be supplied directly without enclosing them in single 
  • or double quotes.
  • Date data types - enclose date values in single quotes in the format 'YYYY-MM-DD'.
Inserting Data Using a PHP Script
Example

When supplying the data values to be inserted into the new table, the following should be considered while 
dealing with different data types.
You can use the same SQL INSERT INTO command into the PHP function mysql_query() to
 insert data into a MySQL table.
This example will take three parameters from the user and will insert them into the MySQL
 table −
<html>

   <head>
      <title>Add New Record in MySQL Database</title>
   </head>

   <body>
      <?php
         if(isset($_POST['add'])) {
            $dbhost = 'localhost';
            $dbuser = 'root';
            $dbpass = 'rootpassword';
            $conn = mysql_connect($dbhost, $dbuser, $dbpass);
         
            if(! $conn ) {
               die('Could not connect: ' . mysql_error());
            }

            if(! get_magic_quotes_gpc() ) {
               $tutorial_title = addslashes ($_POST['tutorial_title']);
               $tutorial_author = addslashes ($_POST['tutorial_author']);
            } else {
               $tutorial_title = $_POST['tutorial_title'];
               $tutorial_author = $_POST['tutorial_author'];
            }

            $submission_date = $_POST['submission_date'];
   
            $sql = "INSERT INTO tutorials_tbl ".
               "(tutorial_title,tutorial_author, submission_date) "."VALUES ".
               "('$tutorial_title','$tutorial_author','$submission_date')";
               mysql_select_db('TUTORIALS');
            $retval = mysql_query( $sql, $conn );
         
            if(! $retval ) {
               die('Could not enter data: ' . mysql_error());
            }
         
            echo "Entered data successfully\n";
            mysql_close($conn);
         } else {
      ?>
   
      <form method = "post" action = "<?php $_PHP_SELF ?>">
         <table width = "600" border = "0" cellspacing = "1" cellpadding = "2">
            <tr>
               <td width = "250">Tutorial Title</td>
               <td>
                  <input name = "tutorial_title" type = "text" id = "tutorial_title">
               </td>
            </tr>
         
            <tr>
               <td width = "250">Tutorial Author</td>
               <td>
                  <input name = "tutorial_author" type = "text" id = "tutorial_author">
               </td>
            </tr>
         
            <tr>
               <td width = "250">Submission Date [   yyyy-mm-dd ]</td>
               <td>
                  <input name = "submission_date" type = "text" id = "submission_date">
               </td>
            </tr>
      
            <tr>
               <td width = "250"> </td>
               <td> </td>
            </tr>
         
            <tr>
               <td width = "250"> </td>
               <td>
                  <input name = "add" type = "submit" id = "add"  value = "Add Tutorial">
               </td>
            </tr>
         </table>
      </form>
   <?php
      }
   ?>
   </body>
</html>

Friday, March 24, 2023

Best website hosting servers



There are many website hosting servers available, and the "best" one depends on your specific needs and requirements. However, here are some popular website hosting servers that are known for their reliability and performance:

  1. Bluehost: This hosting server is popular among bloggers, small businesses, and WordPress users. It offers easy-to-use control panels, reliable uptime, and excellent customer support. https://www.bluehost.com/

  2. HostGator: HostGator is a popular hosting server for small businesses, offering flexible plans, unlimited bandwidth, and 24/7 customer support. https://hotstar.com/

  3. SiteGround: SiteGround is known for its fast loading speeds, excellent customer support, and user-friendly interface. It's a popular choice for WordPress sites and e-commerce stores. https://world.siteground.com/

  4. A2 Hosting: A2 Hosting is a reliable hosting server with fast loading speeds, excellent uptime, and affordable pricing. It offers a variety of hosting plans, including shared, VPS, and dedicated hosting. https://www.a2hosting.com/

  5. DreamHost: DreamHost is a reliable and user-friendly hosting server with a wide range of features and tools. It offers unlimited bandwidth and storage, free SSL certificates, and easy WordPress installation. https://www.dreamhost.com/

It's important to research and compares different hosting servers before choosing one that best suits your needs. Consider factors such as pricing, uptime, customer support, and features offered.


For Professional website contact WEB CODE ADDICT

View this post on Instagram A post shared by WebCodeAddict (@webcodeaddicted)