- #1
nobahar
- 497
- 2
Heeeeeeellllllllllllllooooooooooooo,
I have a question about HTML and PHP:
Firstly, I am using Apache2 and PHP5 (I think) and running it as a localhost.
I created a simple HTML form that sends the variables via post to a PHP file; there are two variables with the names "nickname" and "fullname", respectively:
e.g.
According to a textbook, the PHP file should look like the following:
This just gives me a blank page.
If I do the PHP file in the following way, it works:
It isn't presented in any fancy way, but I get the variables to echo to the screen. I have also passed variables to PHPinfo and it works that way.
I can't see the book being wrong, so I must be missing something obvious.
Any help appreciated.
I have a question about HTML and PHP:
Firstly, I am using Apache2 and PHP5 (I think) and running it as a localhost.
I created a simple HTML form that sends the variables via post to a PHP file; there are two variables with the names "nickname" and "fullname", respectively:
e.g.
Code:
<html>
<head>
<title>Likes form</title>
</head>
<body>
<form action="[PLAIN]http://localhost/phptwo.php"[/PLAIN] method="post">
<h2>Info: </h2>
<p>Nickname: </p>
<input type="text" name="nickname" size="30" maxlength="30" />
<br />
<p>Fullname: </p>
<input type="text" name="fullname" size="30" maxlength="30" />
<br />
<input type="submit" name="submit_likesform" value="Submit info" />
</form>
</body>
</html>
According to a textbook, the PHP file should look like the following:
Code:
<?php
echo "$nickname";
echo "$fullname";
?>
This just gives me a blank page.
If I do the PHP file in the following way, it works:
Code:
<?php
echo $_POST["nickname"];
echo $_POST["fullname"];
?>
It isn't presented in any fancy way, but I get the variables to echo to the screen. I have also passed variables to PHPinfo and it works that way.
I can't see the book being wrong, so I must be missing something obvious.
Any help appreciated.
Last edited by a moderator: