Showing posts with label input. Show all posts
Showing posts with label input. Show all posts

PHP Function With More Than One Value

PHP Function With More Than One Value
 
This article will try to explain how to create a function that can return more than one value, or Returning multiple values from function in PHP. The essence of these functions is the use of arrays and list (); function. Here I will try to give an example function that can separate the first name and last name of a person's name. Create a file named value.php or you can give another name that you want.
 
The contents of the file with:
< ?php
function double_value($fullname)
{
$firstlast = explode(” “, $fullname);
$first_name = $ firstlast[0];
$last_name = $ firstlast[1];
return array($first_name, $last_name);
}
$myfullname = “John Lennon”;
list($myfirstname, $mylastname) = double_value($myfullname);
echo “Full Name : “.$myfullname.”<br>”;
echo “First Name : “.$myfirstname.”<br>”;
echo “Last Name : “.$mylastname ;
?>

The core of its functions :
When a variable used as the contents of the parameter :
double_value ($fullname)
Separate the first and last name by using a space and enter into an array :
$firstlast= explode ("", $fullname);
So that later can be able to access the first name we can use variable $firstlast[0]
and to access last name we can use variable $firstlast[1]
Then do the return value of the form array :
return array ($first_name, $last_name);
With the list() function take two values that shaped an array :
list ($myfirstname, $mylastname) = double_value ($myfullname);
Then show by using echo function :
echo “Full Name : “.$myfullname.”<br>”;
echo “First Name : “.$myfirstname.”<br>”;
echo “Last Name : “.$mylastname ;
That is one example of the algorithm makes the function can return two values.

PHP Function With More Than One Value

JavaScript Switch Instructions


JavaScript Switch Instructions

This instruction allows us to test various values of the same variable.
In this way we can do test of various simpler variable value than using if instructions.

HTML Form Tutorial

HTML Form Tutorial

This post is especially about HTML Form Tutorial so you can make form in HTML document.
Form is used to create forms on web pages. As the name suggests, the form used to take input from the user and will be further processed.
 
Form on web pages is defined by the couple <form> tag and </ FROM>. <form> Tag has two important attributes, namely METHOD attribute to specify how the applicable form, and ACTION attributes are often loaded exact URL form further processing.
Form the basic structure is:
 

<FORM [METHOD="POST|GET]" ACTION="URL">
...
</ FORM>

HTML Input


Input Box
Input is the input box on the form that allows the user to enter a string in one line. To create an input box, HTML provides <input> tag and utilize attribute TYPE = "Text".
 
Another attribute of <input> tag is NAME to declare the name of the input, the VALUE to declare the value of an input, and SIZE to declare the length of an input.