I am trying to create just a basic form using Php and HTML. When I type into the fields and click submit nothing appears on the page except for "Hi,"
This is what I have for the HTML document
<!DOCTYPE html>
<html>
<head>
<title>Php Form</title>
</head>
<body>
<form method="post" action="PHPD1.php">
<label> First Name:<input name="FName" type="text"/></label>
<br>
<label> Last Name:<input name="LName" type="text"/></label>
<br>
<label>Message: <textarea name="message">
</textarea>
</label>
<br>
<input name="submit" type="submit" value="Submit"/>
</form>
</body>
</html>`
and for the php document I have
<html>
<head>
<title>Deliverable 1</title>
</head>
<?php
// Capture the values posted to this php program from the text fields
$FName = $_POST['FName'] ;
$LName = $_POST['LName'] ;
$Message = $_POST['Message'] ;
?>
<body>
Hi, <?php print $FName; ?>
<br>
<?php print $Message; ?>
</body>
</html>
<textarea name="message">
</textarea>
the name given for textarea is "message". so the same name should be used in the php page also to access the value.
instead of
$Message = $_POST['Message'] ;
use
$Message = $_POST['message'] ;
you have done a small mistake. just check now.