0

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..

Edited by pritaeas: Fixed markdown.

5
Contributors
24
Replies
68
Views
4 Years
Discussion Span
Last Post by broj1
0

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.

0

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:

Edited by pritaeas: Added markdown.

0

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 ?

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




</title></head>

<body>

welcome.Your name is:
<?php

echo $_POST["fname"];


?>


</body></html>

Edited by Dani: Formatted code

0

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?

0

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>

Edited by broj1

0

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.

Edited by broj1

0

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

0

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?

0

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

0

<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????

Edited by vicky one

0

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).

0

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

0

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).

Edited by broj1

0

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.

0

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.

Edited by vicky one

0

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...

Edited by vicky one

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.