Computer Science, asked by aishumahesh79, 8 months ago

php coding to display name age address

Answers

Answered by redracoon
0

<!DOCTYPE html>

<html>

<head>

<title></title>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

</head>

<body>

<form method='POST'>

<h2>Please input your name:</h2>

<input type="text" name="name">

<input type="submit" value="Submit Name">

</form>

<?php

//Retrieve name from query string and store to a local variable

$name = $_POST['name'];

echo "<h3> Hello $name </h3>";

?>

</body>

</html>

tq

Answered by ankhidassarma9
0

Answer:

  1. Using echo command, we can display name, age and address.

<html>

 <head>

    <title>Employee Detail</title>

 </head>

 <body>

     <?php

         $name = "Amit";

         $age  = 23;

         $address = "India";

         echo "Employee name is".$name;

         echo "Employee is ".$age."years old";

         echo "He lives in the".$address;

     <?

 </body>

</html>

    2. Using Print command, we can display name, age and address.

   <html>

    <head>

   <title>Employee Detail</title>

    </head>

    <body>

    <?php

         $name = "Amaan";

         $age  = 25;

         $address = "United States";

         print "Employee name is".$name;

         print "<br>";

         print "He is".$age."years old";

         print "<br>";

         print "He lives in the".$address;

     <?

 </body>

</html>

Explanation:

  • echo and print  are  used to output data to the screen.
  • echo has no return value while print has a return value of 1.
  • echo can take multiple arguments  but print can take only one argument.
  • echo is little faster than print.

Similar questions