Write a php script to display welcome message
Here you will learn to write a php script to display welcome message with the name of the user.
HTML Code(greet.html)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | <html> <head><style type="text/css"> div {font-size:20pt;color:blue;font-family:Algerian;text-align:center;width:30%} p{font-size:18pt;color:red;font-weight:bold;align:center;font-family:arial black} .double{border-style:double} .dashed{border-style:dashed} </style> </head> <body> <center><br><br> <div class="double">GREETING MESSAGE</div><br> <div class="dashed"> <form action = "welcome.php" method = "POST"> Enter Your Name: <input type = "text" name = "name" /><br><br> <input type = "submit" /> </div></center> </form> </body> </html> |
PHP Code (welcome.php)
1 2 3 4 5 6 7 8 9 | <?php echo'<font color="green" face="arial" size="6">Welcome</font>'; if(isset($_POST['name'])) { echo ' ' . $_POST['name']; } echo'<p><img src="flower1.jpg" alt="flower" style="float:left;">'; ?> |
Output
Check our other PHP examples