Skip to main content

Create a simple HTML form and accept the user name and display the name through PHP echo statement.

Create a simple HTML form and accept the user name and display the name through PHP echo statement.


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Post Data</title>
</head>
<body>
<form method="POST" action="">
<label>Enter First Name</label>
<input type="text" name="firstname" id="firstname" />
<input type="submit" name="submit_button" value="Submit Name" />
</form>
</body>
</html>
<?php
if(isset($_POST) && !empty($_POST))
{
echo "<h3> Hello ".$_POST['firstname']."</h3>";
}
?>

Output:

Comments

Popular posts from this blog

$var = 'PHP Tutorial'. Put this variable into the title section, h3 tag and as an anchor text within a HTML document.

$var = 'PHP Tutorial'. Put this variable into the title section, h3 tag and as an anchor text within a HTML document.  <?php echo "<html>"; echo "<head>"; echo "<title>"; echo "PHP TUTORIAl"; echo "</title>"; echo "<body>"; echo "<h3>PHP TUTORIAL</h3>"; echo "<hr>"; echo "<p>PHP, an acronym for Hypertext Preprocessor, is a widely-used open source general-purpose scripting language. It is a cross-platform, HTML embedded server-side scripting language and is especially suited for web development.</p>"; echo "</body>"; echo "</head>"; echo "</html>"; ?> Output:

Add Google Translator to your website

GoogleTransalator Add Google Transalator to your website or webpage Step 1 Go to  https://translate.google.com/manager/website/  and sign in to your Google account when you are prompted to. Step 2 Enter Your website url or your can also enter your localpath url and choose Language. Step 3 Click on Next Button and Select Language that you want to display on your Website or webpages. Here you can also select specific language. Step 4 Select your display mode. Step 5 Get code. This code your have to enter into your page. <div id="google_translate_element"></div><script type="text/javascript"> function googleTranslateElementInit() { new google.translate.TranslateElement({pageLanguage: 'en', layout: google.translate.TranslateElement.InlineLayout.SIMPLE}, 'google_translate_element'); } </script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslat...