define variable, take input from form and display in browser through php, DATATYPES

 <!DOCTYPE html>

<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<form method="POST" >
<input name="person" type="text"/>
<button type="submit">submit</button>
</form>

<?php
$name = "Himal "; // $ sign will make a variable
$lastname = "puri ";
echo $name . $lastname." is a good man"; // Unlike in javascript and java, we have to use . after
// variable to connect with it another variable

$num = 5; $num2 = 10;
echo $num + $num2;

$person = $_POST['person'];
echo $person. "is a good man";
?>
</body>
</html>

// String
$name = "coding is fun";
// Integer
$age = 26;

// Float
$marks = 20.45;
// Boolean
$isPassed = true; // We get value of 1 for true, and 0 for false

// Array
$names = array("himal", "sushma", "kamala", 44);
echo $names[3];

Comments

Popular posts from this blog