6

dear all I am a beginer in PHP world (PHP 5.3.5) my web server is IIS fastCGI on win xp I tried to pass values from the HTML form to the php but the data are not passed

this is my html file

<html>
<body>
<form action="welcome.php" method="post">
Name: <input type="text" name="fname" />
Age: <input type="text" name="age" />
<input type="submit" />
</form>
</body>
</html> 

and this is my php file welcome.php

<html>
<body>

Welcome <?php echo $_POST["fname"]; ?>!<br />
You are <?php echo $_POST["age"]; ?> years old.

</body>
</html> 

After pressing submit the output was like this

Welcome!
You are years old.

but it should be like this

Welcome John!
You are 28 years old.

Can you please help me with this.

3
  • it looks like working fine..so please put your code. Commented Feb 28, 2011 at 23:55
  • on your server, create a php page with <? phpinfo(); ?> in it - use that to test if your server is setup correctly for php usage. Commented Mar 1, 2011 at 0:11
  • The code has no errors, works fine. Commented Jan 22, 2016 at 19:20

3 Answers 3

3

on IIS change in the form: method="post" to method="POST" <-- UPPERCASE should solve your issue.

Anyway what about the apache? and PHP version around just 5, flat five :) 5.3.5 on IIS for the beginner? sounds like to get the Mount Everest by night without gloves

Sign up to request clarification or add additional context in comments.

Comments

0

That is pretty standard simple code, and looks correct. One thing you might look at is the way PHP is configured on your server. Also, try using $_REQUEST in place of $_POST on your welcome.php page and see if it still does the same thing.

Try naming your form as well

Comments

0

After looking at your code it seems that it must be a configuration issue.

Steps to resolve this:

Firstly is the code that spits out the page actually welcome.php

Secondly add the following to your php block

var_dump($_POST);

Click submit and if this still shows

array (
)

if so then do

var_dump($_REQUEST);

and post the contents to your post, and show us.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.