HTML in PHP


HTML in PHP


You can also use HTML code in a PHP script. This can be very useful if you have built your
whole page in PHP, but want to include a custom HTML form, for example. All that you need
to do is reverse the order of the HTML and PHP opening tags, opening the page with PHP:

Using HTML in PHP:working with form data POST GET and REQUEST:

<?php
if($_REQUEST[NAME]="add")
{
$Fname = $_POST["Fname"]; $Lname = $_POST["Lname"]; }?>
<html><head><title>Personal INFO</title></head><body>
<form method="post" action="<?php echo $PHP_SELF;?>">
First Name:<input type="text" size="12" maxlength="5" name="Fname"><br />
Last Name:<input type="text" size="12" maxlength="5" name="Lname"><br />
<input type=submit value="Submit" name="add"></form>
<?php echo "Hello, ".$Fname." ".$Lname.".<br />";?>

Output:
HTML in PHP
Hello, J Section Students.

Custom Search

%d bloggers like this: