Hello everyone!

I am new to php language.

I want to know if we install xammp server on our pc . Is there any need to install php 5.5.1 or any other version through php.net and mysql for data base or simply start work on the editor in simple php and sql language having xammp installed??I am much confused upon it.. Can someone help me about it????

The second question is i have made a form and action="form.php" and when i click the submit button it moves to form.php but does not provide the end result which is being fetched from the text area. as form.html is another page and form.php is another page residing with html page location and a;so in htdocs folder in xammp.. Plz help me..

XAMPP is an easy to install Apache distribution containing MySQL, PHP and Perl. XAMPP is easy to install; just download, extract and start the installation. Start here --> http://www.apachefriends.org/en/xampp.html

i click the submit button it moves to form.php but does not provide the end result which is being fetched from the text area. as form.html is another page and form.php is another page residing with html page location and a;so in htdocs folder in xammp.

First, I recommend that you create a thread for each specific question you have. Otherwise, you'll get responses for some or all of your questions, and it will get really hard to read and determine what information is helpful.

i click the submit button it moves to form.php but does not provide the end result which is being fetched from the text area. as form.html is another page and form.php is another page residing with html page location and a;so in htdocs folder in xammp.

Your statement is too vague for me to understand. You need to post some code and a detailed explanation of what you are trying to do and what the error you are seeing is.

form.htm page source code

<html>
<head><title> form.htm
</title></head>
<body>

<form action="extra.php" method="POST">
What is your name?
<input type="text" name="fname">
<br>
<br>
<input type="submit">


</form></body></html>

form.php source code// rediding in htdocs folder in c:\xammp\htdocs\

<html>
<head><title>form.php</title></head>
<body>

welcome.Your name is:
<?php

echo $_POST["fname"];


?>
</body></html>

The problem is that it does not provide the name.Result is below//

welcome.Your name is:

Isn’t the action URL ( you don't have actual actions in this ...) extra.php ? Isn’t this plain old PHP page named form.htm ? So you send a request a to the extra.php and you try to get it through form.htm ?

Rename form.php file to extra.php and it should work.

//it didnt work
<html>
<head><title>extra.php




</title></head>

<body>

welcome.Your name is:
<?php

echo $_POST["fname"];


?>


</body></html>

Make an empty php script (say test.php) to test your PHP instalation. The only code in the script should be:

<?php
phpinfo();
?>

Does it display the information about your installation?

yes it gave a page with huge info...Now what to do??

It works OK on my comp. Check if the code and filenames are the same:

form.htm

<html>
<head><title> form.htm
</title></head>
<body>

<form action="extra.php" method="POST">
What is your name?
<input type="text" name="fname">
<br>
<br>
<input type="submit">


</form></body></html>

extra.php

<html>
<head><title>form.php</title></head>
<body>

welcome.Your name is:
<?php

echo $_POST["fname"];


?>
</body></html>

You can also put this temporary debug code on the very beginning of the extra.php file (before the <html> tag):

<?php
die(print_r($_POST, 1));
?>

Upon submitting the form it should display the contents of $_POST and stop the script. Post the displayed output here.

nOw its irritating alot as it is second day m facing this problem

nOw its irritating alot as it is second day m facing this problem

I believe that. Have you tried the debug code from my previous post? Is there any output?

the same reult
welcome. Your name is:
thats all.
What if i embbed the form code in form.php and then try

i have done that and then it gives name by

http://localhost/form.php

your name is:vikcy

so why it does not access the information at different pages??

<html>
<head><title>form.php</title></head>
<body>

<form action="form.php" method="POST">
What is your name?
<input type="text" name="fname">
<br>
<br>
<input type="submit">
</form>
welcome.Your name is:
<?php
echo $_POST["fname"];
?>
</body></html>

what do u think about it. But now we totally acces the form.php, no function of form.html????

As I said, it works OK on my computer.

I would change the above code to:

<html>
<head><title>form.php</title></head>
<body>

<form action="extra.php" method="POST">
What is your name?
<input type="text" name="fname">
<br>
<br>
<input type="submit">
</form>

<?php
if(isset($_POST["fname"])) {
    echo 'Welcome. Your name is: ' . $_POST["fname"];
}
?>

</body></html>

You have to check for existence of the $_POST["fname"] element before using it (it won't exist until form is submitted).

i saved your code as form.php and opened http://localhost/form.php
it worked provided the name

Then what to be done with form.html. It sholud be opened thorugh html page or through http://localhost/form.php....
Dont u think that submit button should take the browser to the server's responsed page??

it takes the value by $_POST but does not give output if php code is separated from, form code in html page??

Then what to be done with form.html. It sholud be opened thorugh html page or through http://localhost/form.php....

The html page should be opened through form.html.

Dont u think that submit button should take the browser to the server's responsed page??

Submit button will open the page that is defined in the action attribute (it can be the same page as the form if you wish).

..

I have the condition
c:\desktop\form\form.htm
c:\desktop\form.php

and a copy of form.php in htdocs

c:\xammp\htdocs\form.php

i open form.htm and fill the form and press submit then name is not provided bu server. only welcome.your nameis:

but when i open http://localhost/form.php with your code written in form.php then it provides the name.

Do m i doing wrong does not it provide the name having php code in different page and form code in different page. as i have stored form.php(my code) copy in both locaations with form.htm and also in htdocs.
It will be explained now.

I have the condition
c:\desktop\form\form.htm
c:\desktop\form.php

and a copy of form.php in htdocs

c:\xammp\htdocs\form.php

i open form.htm and fill the form and press submit then name is not provided bu server. only welcome.your nameis:

but when i open http://localhost/form.php with your code written in form.php then it provides the name.

Do m i doing wrong does not it provide the name having php code in different page and form code in different page. as i have stored form.php(only php script not form code) copy in both locaations with form.htm and also in htdocs.
It will be explained now.

vicky one gave you very descriptive answer. I hope it is the best answer to your query.

THx for viewing tourscambodia..and Broj1 helped me alot regarding this and i have a question in the last three lines of above post i repeat them.
if script page and orignal form html page are separated from each other having the same directory and one copy of script code on xammp server then it is not working..
But if i embbed the form code(html) in the script page(script code) and make a single page (form.php(html and php both coded))then by accessing http://localhost/form.php it gives answer..

i want separate page form.html and separate page form.php. Opening html page and clickingg submit button should work towards server's response.

i hope Broj1 and you understand it..wht is my confusion...

html files can not execute php code so give all files a php extension.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.