php form

<html> <head><title> form.htm </title></head> <body> <form action="form.php" method="POST"> What is your name? <input type="text" name="fname"> <br> <br> <input type="submit"> </form></body></html>

[php]

form.php

welcome.Your name is:
<?php
echo $_POST[“fname”];
?>

[/php]

What is the problem in the code using the xammp server it gives the result

welcome.Your name is:

But does not provide the name written in text area of form.html

Your code is working fine.

Area you using the .php extension or .html???

If you use .html or .htm, the server will not process PHP.

i am opening the page form.html filling the form and click the submit button which opens form.php but does not provide the name…

is a copy of form.php should be placed at the same location with form.html in my hard drive… As form.php should be placed at htdocs of xammp.

yes, according to you code:

<form action="form.php" method="POST">

both your files should be in the same directory.

i have them in same directory but still it is not working… i want to fill form in form.htm and then click submit, which should open form.php and provide server’s response…

making a single page form.php and having both codes in it(HTML and php) it works good usin…http://localhost/form.php but i want it should work through html page.

don’t know what’s wrong with your XAMPP.??? The code works perfectly fine on my side.

ok thx tanzeel. :slight_smile:

If there isnt any php on the index page, then it doesnt need to be a php page. Add the encypt attribute,set it www encoded page. You could do some simple jquery too.

Sponsor our Newsletter | Privacy Policy | Terms of Service