Help I am beginner! What is wrong with this form?

I wrote up all three files and put them in a sub-directory of htdocs directory of XAMPP software.
Then I loaded up “index.php” from the browser. The form filed comes. When I enter the details in the form and clicked submit, the same page reloaded and the form becomes blank.
I wanted to know what is wrong with these? :confused:

Here are the files:

http://www.ziddu.com/download/23058035/controller.zip.html

Show us your code. no links.

You really need to display the code here, I won’t and I am sure others won’t download a zip file to then try to assist you.

So please help us to help you by displaying the code properly.

Sorry for inconvenience guys. :frowning:
Here’s the code:

[B]index.php:

[/B]

<?phpif (!isset($_REQUEST['fistname']))
{
include 'form.php';
}
else
{
$fistname = $_REQUEST['firstname'];
$middlename = $_REQUEST['middlename'];
$lastname = $_REQUEST['lastname'];


if ($firstname == 'Akash' and $middlename == 'the' and $lastname == 'Developer')
{
$output = 'Welcome my friend!';
}
else
{
$output = 'Welcome ' . htmlspecialchars($firstname, ENT_QUOTES, 'UTF-8') . ' ' . htmlspecialchars($middlename, ENT_QUOTES, 'UTF-8') . ' ' . htmlspecialchars($lastname, ENT_QUOTES, 'UTF-8');
}
include 'include.php';
}

[B]include.php:

[/B]

<html><head>
<title>Form Include</title>
</head>
<body>
<p><?php echo $output; ?></p>
</body>
</html>

[B]form.php:

[/B]

<html><head>
<title>Form</title>
</head>
<body>
<form action=' ' method='post'>
<div><label for='fistname'>First Name: <input type='text' name='firstname' id='firstname'></label></div>
<div><label for='middlename'>Middle Name: <input type='text' name='middlename' id='middlename'></label></div>
<div><label for='lastname'>Last Name: <input type='text' name='lastname' id='lastname'></label></div>
<div><input type='submit' value='GO'></div>
</body>
</html>

Try adding a space at the start of your PHP. I.e.

This

<?php if

instead of this:

<?phpif

Try correcting all your uses of $fistname to $firstname.

Well spotted. :slight_smile:

thanks @ginerjm
got it! :slight_smile: