Help me please...I am newbie for PHP...
05-12-2005, 12:32 PM
|
Help me please...I am newbie for PHP...
|
Posts: 10
|
Dear Expert,
I just installed PHP 5.0.4 into my Windows XP Pro using Installer...After all, I tried to test a simple statement as follow:
First, I created my HTML page called "test.html" and do these following codes:
<html>
<body>
<form action="welcome.php" method="POST">
Enter your name: <input type="text" name="name" />
Enter your age: <input type="text" name="age" />
<input type="submit" />
</form>
</body>
</html>
Secondly, I created "welcome.php" and put these following codes:
<html>
<body>
Welcome <?php echo $_POST["name"]; ?>.<br />
You are <?php echo $_POST["age"]; ?> years old!
</body>
</html>
When I click "Submit" button it should come out like this:
Welcome John.
You are 28 years old!
as I put name: John and year: 28....However, in fact, when I click submit button it still appear like this:
<html>
<body>
Welcome <?php echo $_POST["name"]; ?>.<br />
You are <?php echo $_POST["age"]; ?> years old!
</body>
</html>
same as the code...What happen with this..???..what's wrong with this..???..Anyone could help me to solve this problem please..???..in order my HTML and PHP can work together..??
Thank you very much for your HELP and ASSISTANCE...
Best Regards,
Stephanie 
|
|
|
|
05-12-2005, 12:57 PM
|
|
Posts: 52
|
It looks like you're missing the "What to do" if you click submit.
Try This,
PHP Code:
<?php
if (isset($_POST['submit'])) {
echo '<p>Welcome {$_POST['name']} </p>';<br />
echo '<p>You are {$_POST['age']} years old!</p>';
}
?>
__________________
No more yankey my wankey, the Donger need food!
Last edited by merlin; 05-12-2005 at 01:07 PM..
|
|
|
|
05-12-2005, 01:12 PM
|
|
Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
|
PHP isn't parsing the .php pages.
Check the application mappings and make sure that .php is mapped to c:\php\php.exe
__________________
Chris. ->> Please login or register to view this content. Registration is FREE <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
|
|
|
|
05-12-2005, 03:39 PM
|
|
Posts: 52
|
Or, that could also work 
__________________
No more yankey my wankey, the Donger need food!
|
|
|
|
05-12-2005, 07:35 PM
|
|
Posts: 10
|
Thanks for all your reply. However, I had already tried what Merlin suggest but still doesnt work....And, Chris...about mapping idea, honestly after I read trough...I really have no idea what to do.....Would you please give me a walktrough about what to do in order can test my PHP page please..????..instead of reading the link that you gave (because I really have no idea about that)..and the most important to know is, when I was installing PHP using installer for windows, I did not set to IIS...I set to configure manually....Because I dont know what to do about that....I really really need your help please...
Thanks very much for your kind help and assistance.
Stephanie
|
|
|
|
05-13-2005, 07:02 AM
|
|
Posts: 234
Location: Hamburg
|
Well, I tested the code on my machine and it works fine exactly how you had it in the beginning. It must be a problem with your php installation. I would say try uninstalling it and reinstalling or try to download Xammp which is apache, mysql, php, everything all in one and really easy to install. You will find it at www.apachefriends.org
Good luck.
__________________
I think, therefore I am..... I think.
|
|
|
|
05-13-2005, 01:45 PM
|
|
Posts: 10
|
Thanks for your guidance...However, I have already installed XAMPP...Now, what should I do in order my PHP files can be readed please..???..Please let me know how/walktrough, because I have no idea about this XAMPP...
Thanks very much for your kind helps...
Stephanie
|
|
|
|
05-14-2005, 08:37 AM
|
|
Posts: 234
Location: Hamburg
|
OK, if you´ve installed xampp with the windows installation, you should have a directory C:\xampp. Now, in that directory, you have a file named "xampp_start.exe". Double click this (easier to create a shortcut somewhere) and an msdos window opens and starts Apache, MySQL etc. Don´t close this window or Apache stops!
Now open your browser and type in "http://localhost/" You should get a page to choose your language, click english and you should get a Welcome page for XAMPP. Congratulations, you have installed the server correctly! If this doesn´t work, try uninstalling xampp and reinstalling it and note where it´s installed.
If it is working you should have some links on the left, click on "phpinfo()" and you should get a page showing all your php setting etc. Congratulations, php works on your machine!
Now, all your www documents are, by default, run from the "C:\xampp\htdocs" folder. You can create a folder there called "test" or whatever. Now put the "test.html" and "welcome.php" files in the test folder.
Now go to your browser and type in "http://localhost/test/test.html" and you should see the page. Fill in the info and submit. It should work now.
Good luck.
Let me know what happened.
__________________
I think, therefore I am..... I think.
|
|
|
|
05-14-2005, 09:07 AM
|
|
Posts: 3,189
|
The problem is that Apache is not recognizing php files as belonging to the php binary. I believe in your apache directory, under the folder confs there should be a file called httpd.conf. You should find something similiar to this in that file...
LoadModule php5_module "c:/xamp/php/sapi/php5apache2.dll"
Directly underneath it add this...
AddType application/x-httpd-php .php
I believe that should do the trick (after you restart apache).
|
|
|
|
05-14-2005, 12:15 PM
|
|
Posts: 10
|
Hi,
When I already create a folder called "Test" at "htdocs" folder. However, when I try to load my "test.html" to create output "welcome.php", it shown like this error message:
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in F:\XAMPP\apachefriends\xampp\htdocs\Test\welcome.p hp on line 6
So, what should I do then....
I attach my test.html and welcome.php as TXT files for your consideration.
Thanks,
Stephanie
|
|
|
|
05-14-2005, 01:07 PM
|
|
Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
|
the <br /> is outside the ;
__________________
Chris. ->> Please login or register to view this content. Registration is FREE <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
|
|
|
|
05-14-2005, 07:27 PM
|
|
Posts: 234
Location: Hamburg
|
Yeah, chrishirst is right, it should read "echo '<p>Welcome {$_POST['name']} </p><br />';"
__________________
I think, therefore I am..... I think.
|
|
|
|
05-14-2005, 09:35 PM
|
|
Posts: 3,189
|
whats with the {}'s around your variables?
|
|
|
|
05-14-2005, 10:15 PM
|
|
Posts: 10
|
Hi, Thanks for your reply...however, it wont works...still error...Any other hints please...???
|
|
|
|
05-16-2005, 09:30 PM
|
|
Posts: 10
|
help me please..???
|
|
|
|
05-16-2005, 09:35 PM
|
|
Posts: 3,189
|
Quote:
|
Originally Posted by cptnwinky
whats with the {}'s around your variables?
|
????
|
|
|
|
05-17-2005, 12:48 AM
|
|
Posts: 10
|
Hi,
I dont understand what are you talking about..???
|
|
|
|
05-17-2005, 01:03 AM
|
|
Posts: 174
Location: Nigeria/Lagos
|
Don't post twice pls
__________________
Life is just lyke a school where everybody goes to learn one or two thing. the more u school, the more u learn more about school..The more we live our lifes.. the more we learn more about life.
Please login or register to view this content. Registration is FREE
|
|
|
|
05-17-2005, 03:10 AM
|
|
Posts: 10
|
Hi, I did not post twice...I just need helps BUT no one answers my questions....
|
|
|
|
05-17-2005, 03:21 AM
|
|
Posts: 1,168
Name: Dragos-Valentin
Location: Cluj-Napoca, RO
|
zach007,
i would say uninstall everything, go to http://apache2triad.net , download the latest build, install it and try it.
it's pretty much the same, the difference is that i never had any problems with it.
it will be pretty much the same as xampp, it will install in c:\apache2triad if you don't specify otherwise, and your pages will be in c:\apache2triad\htdocs\ ... if that doesn't work eighter i really wouldn't know what to say.
__________________
.
» Please remember to add to my Talkupation if you enjoyed my post. Thank you :)
.
|
|
|
|
|
« Reply to Help me please...I am newbie for PHP...
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|