I'm learning PHP from a book called "PHP/MySQL Programming for the absolute beginner".
In it there's a program where the user types their name and clicks the submit button. This is suppose to create a variable $userName and the php page is suppose to display Hi there, $userName!
When I tried it on my local machine and on these servers it wouldn't work correctly. The html page displayed normally and the php page displayed fine except it wouldn't print the $userName as if it had never recieved it.
Heres the code:
HTML part:
<html>
<head>
<title>What's your name?</title>
</head>
<body>
<h1>What's your name?</h1>
<h3>Writing a form for user input</h3>
<form method = "post" action = "hiUser.php">
Please type your name:
<input type = "text" name = "userName">
<br>
<input type = "submit">
</form>
</body>
</html>
PHP part:
<html>
<head>
<title>Hi User</title>
</head>
<body>
<h1>Hi User</h1>
<h3>PHP program that receives a value from "whatsName"</h3>
<?
print "<h3>Hi there, $userName!</h3>";
?>
</body>
</html>
What's wrong with it? From what I've learned so far the code should work, it seems to make sense. :happysad:
In it there's a program where the user types their name and clicks the submit button. This is suppose to create a variable $userName and the php page is suppose to display Hi there, $userName!
When I tried it on my local machine and on these servers it wouldn't work correctly. The html page displayed normally and the php page displayed fine except it wouldn't print the $userName as if it had never recieved it.
Heres the code:
HTML part:
<html>
<head>
<title>What's your name?</title>
</head>
<body>
<h1>What's your name?</h1>
<h3>Writing a form for user input</h3>
<form method = "post" action = "hiUser.php">
Please type your name:
<input type = "text" name = "userName">
<br>
<input type = "submit">
</form>
</body>
</html>
PHP part:
<html>
<head>
<title>Hi User</title>
</head>
<body>
<h1>Hi User</h1>
<h3>PHP program that receives a value from "whatsName"</h3>
<?
print "<h3>Hi there, $userName!</h3>";
?>
</body>
</html>
What's wrong with it? From what I've learned so far the code should work, it seems to make sense. :happysad: