What are the Tags used to create Forms?

What are the Tags used to create Forms?

HTML forms are used to collect some data from the site visitor. The HTML <form>…..</form> tag is used to create an HTML form

<input>
<textarea>
<button>
<select>
<option>
<optgroup>
<fieldset>
<label>

Why Input Tag is used?

<input> tag prompts the user to enter data and also request for the information from the web server after submitting the web form.

How it is Used?

<form>
	<input>
</form>
Tagged : / / / / / / / /

Tutorial for Reading file on File Handling in PHP

What is Reading file on File Handling?

PHP has a number of functions for reading data from files. You may read entire file data, read data line by line, or read data character by character using various methods.

How many types of PHP file Read Functions are:-

The available PHP file read functions are given below.

  • fread()
  • fgets()
  • feof()

PHP readfile() Function

Reads a file and publishes it to the output buffer with the readfile() method.

Assume we have a text file on the server named “webdictionary.txt” that looks like this:

AJAX = Asynchronous JavaScript and XML
CSS = Cascading Style Sheets
HTML = Hyper Text Markup Language
PHP = PHP Hypertext Preprocessor
SQL = Structured Query Language
SVG = Scalable Vector Graphics
XML = EXtensible Markup Language

The following is the PHP code for reading the file and writing it to the output buffer (the readfile() method returns the number of bytes read if successful):

Example:-

If all you want to do is open a file and read its contents, the readfile() method comes in handy.

Tagged : / / / / / / / / / / / /

DOCTYPE Declaration HTML5

<!DOCTYPE html>

HTML 5 Tags

  • Header – It specifies a header for a document or section.
  • Nav – It defines navigation links.
  • Section – It defines a section in a document.
  • Article – It defines an article. For example a blog post or forum post etc.
  • Aside – It can define content aside from the page content like a sidebar.
  • Details – It is used to defines additional details that the user can view or hide. It has one attribute-value pair which is open = “open” and that means by default the data will be visible for users/viewers. By default it has False value so the details will be hidden.
  • Summary – It is used to defines a visible heading for a <details> element.
  • Footer – It specifies a footer for a document or section.

Meter Tag

It defines a scalar measurement within a known range or a fraction value. This is also known as a gauge. It should not be used to indicate the progress bar. If the browser doesn’t support the meter tag then it will show text written between the opening meter tag and the closing meter tag.

Ex:-

<meter value=“20” max=“100” min=“10”>Range</meter>

<meter low=”60″ high=”80″ value=”100″ max=”100″>Range</meter>

Meter Tag Attributes

AttributeValueDescription
valueNumberSpecifies the current value of the meter. This must be between the min and max values.
formForm_idIt associates the <meter> with a <form>
highNumberIt specifies the range that is considered to be a high value. This must be less than the max value.
lowNumberIt specifies the range that is considered to be a low value. This must be greater than min value.
maxNumberIt specifies the max value of the range.
minNumberIt specifies min value of the range.
optimumNumberIt specifies what value is the optimal value for the meter.
  • Mark – This tag is used to highlight text or part of the text. Ex: – <p>This is <mark>Geekyshows</mark></p>
  • Dialog – This tag defines a dialog box or window. It can be used to create popup dialogs. It has one attribute-value pair which is open = “open” and that means by default the data will be visible for users/viewers. By default it has False value so the data will be hidden. Ex: – <dialog>Click Here</dialog>
  • Main – This tag specifies the main content of a document. The content inside the <main> element should be unique to the document. It should not contain any content that is repeated across documents such as sidebars, navigation links, copyright information, site logos, and search forms. There must not be more than one <main> element in a document. The <main> element must NOT be a descendant of an <article>, <aside>, <footer>, <header>, or <nav> element. Ex: – <main><article>This is art</article></main>
  • wbr – The <wbr> (Word Break Opportunity) element specifies a position within text where the browser may optionally break a line if necessary. Ex: – <p>Hello worldddddddddddddddddd<wbr>welcome</wbr></p>
  • Figure – The <figure> tag specifies self-contained content, like illustrations, diagrams, photos, code listings, etc.  Ex: – <figure> <img src=“image.jpg“ width=”304″ height=”228″> </figure>
  • figcaption – The <figcaption> tag defines a caption for a <figure> element. The <figcaption> element can be placed as the first or last child of the <figure> element. Ex: –
     <figure>
       <img src=“image.jpg" width="304" height="228">
       <figcaption>Picture One</figcaption>
     </figure>
  • Progress – The <progress> element represents the completion progress of a task. It has two attributes max which Specifies how much work the task requires in total and value which Specifies how much of the task has been completed. It must be a valid floating point number between 0 and max, or between 0 and 1 if the max attribute is not present. Ex: –  <progress id=”bar” value=”0″ max=”100″> </progress>
Tagged : / / / / / / / /

HTML: Id Attribute

The id attribute specifies a unique id for an HTML element. The value must be unique within the HTML document.

The id attribute is mostly used to point to a style in a style sheet, and by JavaScript (via the HTML DOM) to manipulate the element with the specific id. The id attribute can be used on any HTML element.

Rules

  • Must begin with a letter A-Z or a-z.
  • A class name cannot start with a number.
  • Must not contain any space characters.
  • Can be followed by: letters (A-Za-z), digits (0-9), hyphens (“-“), and underscores (“_”).
  • In HTML, all values are case-insensitive.
<html>
	<head>
		<title> id attribute</title>
		<style>
			#top{
				color: blue;
			}
			#imp{
				color: brown;
			}
		</style>
	</head>
	<body>
		<a href="#imp">Important</a>
		<p id="top">
			Once upon a time, all the birds - the swans, cranes, </p>
		<h3 id="imp">
			Goodwill is that unseen force which is </h3>
		<p>He has neither the time, nor the interest to bother </p>
		<a href="#top">Go to Top</a>
	</body>
</html>
Tagged : / / / / / / /

HTML: Class Attribute

The HTML class attribute makes it possible to define equal styles for elements with the same class name. The class attribute specifies one or more class names for an element. The class attribute is mostly used to point to a class in a style sheet. However, it can also be used by JavaScript (via the HTML DOM) to make changes to HTML elements with a specified class.

In HTML5, the class attribute can be used on any HTML element.

Rules

  • Must begin with a letter A-Z or a-z.
  • A class name cannot start with a number.
  • Must not contain any space characters.
  • Can be followed by: letters (A-Za-z), digits (0-9), hyphens (“-“), and underscores (“_”).
  • In HTML, all values are case-insensitive.
<html>
	<head>
		<title>class tag</title>
		<style>
			.red {color: #FF0000; font-size: 60px;}
		</style> 
	</head>
	<body>
	<h2 class=red> Heading line </h2>
	<p class =red>1st paragraph line</p>
	<p> paragraph tag </p>
	</body>
</html>

More than one class name

To specify multiple classes, separate the class names with a space. This allows you to combine several CSS classes for one HTML element. Syntax:- class=“class_name1 class_name2 class_nameN” Ex:- <p class =“red look”>I am first paragraph</p>

<html>
	<head>
		<title>class name twice or max </title>
		<style>
			p.red {color: #FF0000;}
			p.look{font-size: 100px;}
			.algn{text-align: center;}
		</style> 
	</head>
	<body>
	<h2>I am Heading</h2>
	<p class ="red look"> first paragraph</p>
	<p class="red algn">second paragraph</p>
	
	</body>
</html>

Tagged : / / / / / / /

HTML: Style Tag

The <style> tag is used to declare style sheets within the head of  HTML document. Inside the <style> element you specify how HTML elements should render in a browser. Each HTML document can contain multiple <style> tags.

AttributeValueDescription
mediamedia_querySpecifies what media/device the media resource is optimized for
scopedscopedSpecifies that the styles only apply to this element’s parent element and that element’s child elements
typetext/cssSpecifies the media type of the <style> tag
<html>
	<head>
		<title>html_style</title>
		
		</style>
	</head>
	<body style="background-color: rgb(180, 221, 67);">
	<h1 style="text-align: center;">Style tag</h1>
	<p style="margin-bottom: auto;">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ullam, nobis.</p>
  <hr>
  <br>
	<p style="color: blue;">Lorem ipsum dolor sit amet consectetur adipisicing elit. Fuga, eligendi?</p>
	</body>
</html>
Tagged : / / / / / / /

Complete tutorial for Function in PHP

What is Function?

Function are those callable section of code that you can pass data to, and that can return data to you. Function are subprograms which are used to compute a value or perform a task.

PHP Functions Tutorial - Learn PHP Programming - YouTube

Which are the Importance of Function?

  • Easy to debug
  • Reusability
  • No code repetition
  • Easy to handle codes

How to create a Function?

Syntax:-

function function_name( )
{

Block of statement;

}
How to Define, Call & Create a function in PHP? - DevOpsSchool.com

Example:-

Some rules for creating a function:-

  • Function name only starts with a letter, an underscore ( _ ).
  • Function name cannot start with a number.
  • Do not use Predefined constant name e.g. PHP_VERSION ,PHP_OS etc.
  • Do not use reserved keywords. e.g. else, if etc.
  • Function names are case-insensitive, though it is usually good form to call functions as they appear in their declaration.

How Function Calls in code

Tagged : / / / / / / / / / / / / / / /

Complete Tutorial of Numeric Array

What is Numeric Array?

Numeric arrays allow us to store numerous values of the same data type in a single variable rather than creating multiple variables for each value. These values can then be accessed using an index, which is always a number in numeric arrays.

How to declare and initialize an array?

There are two ways to create an array. Let’s take a look at both these ways in the Following example:

1. Accessing the elements

You must know the index value of an array’s items in order to access them.

Example:-

2. Length of an array

The in-built function count can be used to count the length of an array, or the number of elements in the array.

Example:-

Tagged : / / / / / / / / /

Tutorials for PHP Loops

What is Loop?

A loop is a repetition control structure. it causes a single statement or  block to be executed repeatedly What is a loop? - ppt download

A loop is an Iterative Control Structure that requires the same number of codes to be executed several times until a specific condition is met. When writing code, you may want a specific block of code to run a certain number of times. As a result, rather than applying nearly similar code lines to a script, we can employ loops.

What are the Different types of Loops?

PHP 7 Fundamental Tutorial for Beginners - PHP Loop - DevOpsSchool.com

Loops are used repeatedly to run the same piece of code as long as a given condition is met. A loop’s basic premise is to simplify recurring procedures in a programmer in order to save time and effort. PHP supports four different loop styles.

  • while – Loops through a code block as long as the given condition is true.
  • do...while – The code block running once and then is tested. State. If the condition is true, the declaration shall be repeated until the condition stated is true.
  • for – Loops via a code block before a given number is reached in the counter.
  • foreach – Loops for each unit of an array across a block of code.

Why to Use Loops?

When trying to recreate code, it might be tedious to retype or copy and paste the same code over and over again. Worse, unintentional mistakes might lead to programme malfunctions.

That’s quite a few keystrokes! What if you decide later that you want to start each statement with “The count is currently: ”? You’d have to copy it and paste it into every single line.

Fortunately, loops are a function in most programming languages that allows you to automatically repeat code before such requirements are met. Iteration is a phrase used to describe the repetition of code, and it refers to each time the code is executed. Loops will reduce the number of lines of code you write while still allowing you to update it later.

PHP is no exception, as it offers a variety of ways to repeat the execution of a code block.

This Article has cover the following PHP loop types:

  • while
  • do … while
  • for
  • foreach

There are conditions in each of these loops that prevent the loop from executing. If these requirements are not met, an endless loop will follow, and the software will never be able to quit executing the code block.

How to use loops in PHP?

In order to write effective code, any programmer needs have a thorough understanding of loops and how to use them effectively in programming.

When writing code, we must always repeat a same set of functions. Performing them one at a time would result in a higher number of lines of code and a longer duration. As a result, the software gets more difficult to understand. As a result, instead of using loops to run the code, we can use them!

Tagged : / / / / / / / / / / / / / /

Tutorials for PHP Functions

What is Functions?

Complete Guide and Tutorials for PHP Functions with example -  DevOpsSchool.com

A function is a segment of code in a program that is written to do a certain task. We should compare functions to workers in a real-world workplace to have a better grasp of how they work. Assume the management delegated the duty of determining the annual budget to one of his employees. So, what will be the outcome of this procedure? The employee would ask his supervisor for data, perform estimations, calculate the budget, and report the results to his superior. Functions work in a similar fashion. They accept data as an argument, process it using a set of statements or operations, and then return the output.

How many Types of Functions in PHP?

Complete Guide and Tutorials for PHP Functions with example -  DevOpsSchool.com

There are Two Types of Functions :-

User Defined Functions:-These capabilities are used by developers and programmers when they need to execute their own logic. This functions are specified with the keyword function, and when a function call is made, a sequence of statements will be written within the function to execute it. Simply type functionname() in the address bar, and the function will be run.

Built-in functions:- These routines offer us with already-built-in library functionality. The PHP installation kit includes several capabilities, making the language more efficient and helpful. To use the function’s attributes, all we have to do is call it when we want the desired outcome. PHP makes use of date, numeric, string, and other built-in functions.

  • String Functions: These PHP features include built-in support for working with strings. Some of the string methods in PHP include strpos(), strncmp(), strrev(), and strlen() ,
  • Date Function: The format is a human-readable UNIX date and time format, and these functions are PHP standard components.
  • Numeric Functions: These functions have their own preset logic for numeric operations that PHP provides. As a result, it will either return a Boolean or a numeric value. Among them are is number(), number format(), round(), and other numeric procedures.

Why we should Use Functions in PHP?

Reusability:- This programming language has a feature that reduces the amount of lines of code that must be written many times. This would save time and effort for the developer or coder. We can put a piece of code in a feature and call it whenever and wherever it’s needed if it has to be used in many locations. This may be done by calling the functions from other programmes or from inside the same package.

Easier Error Detection:- Because the code is written as functions rather than single blocks, any problems may be immediately and readily recognized and rectified.

Easily Maintained:- Because functions are used throughout the program, we may quickly modify any function or line of code in the function, and the change will be reflected. As a result, it is simple to maintain everywhere.

How to create functions in PHP?

Complete Guide and Tutorials for PHP Functions with example -  DevOpsSchool.com

A function is to find a collection of statements in a programmer repeatedly. When a function in a program is invoked, it is simply implemented. There are a few things to keep in mind while creating a user-identified feature.

  • Any word ending in an opened and closed parenthesis is a feature.
  • The function keyword is commonly used to start a name of the function.
  • Type your name followed by a parenthesis to launch a command.
  • The initial letter in a function word cannot be a number. It might start with a letter or an emphasis.
  • The name of a feature is important.

Example:-

Tagged : / / / / / / / / / / / /