I'm working on a project to create a blog-like webpage using PHP. I want to print the text on the screen above the form but this appears to not be possible as the variables are attempting to $_GET
the data from the form before the data is entered. Is it possible to place the text above the form?
Here is my code so far: (The PHP updates the screen by putting "basic.php" (the file name) into the action
attribute of the <form>
tag)
<!-- this file is called basic.php-->
<!DOCTYPE html>
<html>
<head>
<title>My Blog</title>
<style type = "text/css">
h2
{
color:#FF2312;
text-align:center;
font-family:Impact;
font-size:39px;
}
p
{
font-family:Verdana;
text-align:center;
color:#000000;
font-size:25px;
}
</style>
</head>
<body>
<?php
$subject=$_GET["msg"];//variable defined but attempts to get unentered data
?>
<i> <?php print $subject;//prints var but gets error message because $subject can't get form data ?></i>
<!--want to print text above form-->
<form name = "post" action = "basic.php" method = "get">
<input type = "text" name = "msg">
<input type = "submit">
</form>
</body>
</html>