I just got started with php. I have a form in a web page that directs to handle.php, like this:
<form action = "handle.php" method="post">
<p><b>name:</b> <input type = "text" name = "name" size="20"/><p>
<input type="submit" name="submit" value="submit my info">
</form>
In my handle.php, this is what I have:
<!DOCTYPE HTML>
<html>
<head>
<title> Hello! </title>
</head>
<body>
<?php
echo "<p>Name: $_REQUEST['name']<p>";
?>
<p> Hi</p>
</body>
</html>
This page appears completely empty. Interestingly, if I remove $_REQUEST['name'], then everything is fine. Seems to me that calling $_REQUEST makes the page empty (i check the source code and theres nothing there).
What am I doing wrong? thanks.
You have error reporting off and you are receiving a fatal error, which is why you are not seeing anything. Inline variables can’t be used the way you do it so try replacing your echo with this:
or this: