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
<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>
<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.
PHP and HTML interact a lot: PHP can generate HTML, and HTML can pass information to PHP.
PHP $_POST is a PHP super global variable which is used to collect form data after submitting an HTML form with method="post". $_POST is also widely used to pass variables.
Open your web browser and type your localhost address followed by '\form1. php'. Output: It will open your form like this, asked information will be passed to the PHP page linked with the form (action=”form2. php”) with the use of the POST method.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With