starting with the language....

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

ayushigarg
New php-forum User
New php-forum User
Posts: 3
Joined: Mon Jul 08, 2013 5:25 am

starting with the language....

Postby ayushigarg » Mon Jul 08, 2013 5:37 am

I am a new user and i have been trying to learn it from w3schools.org. supposedly this code should take input and use it as a parameter. but when i tried it, it seems the parameters are not accepted into the php page. i'm attaching a screenshot for understanding of the problem. Please help.
PHP:

Code: Select all

<form action="welcome.php" method="post">
Name: <input type="text" name="fname">
Age: <input type="text" name="age">
<input type="submit">
</form>
 

HTML:

Code: Select all

Welcome <?php echo $_POST["fname"]; ?>!<br>
You are <?php echo $_POST["age"]; ?> years old.
Attachments
Untitled.png
screen shot
Untitled.png (72.29 KiB) Viewed 382 times

johnj
php-forum Super User
php-forum Super User
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: starting with the language....

Postby johnj » Mon Jul 08, 2013 6:09 am

You need to put welcome.php in the root folder of your web server and not on the C: drive. Please download a package like XAMPP or WAMP where you have the web server, database etc. In case of xampp, you should put this file in htdocs and access this page using http://localhost/welcome.php

ayushigarg
New php-forum User
New php-forum User
Posts: 3
Joined: Mon Jul 08, 2013 5:25 am

Re: starting with the language....

Postby ayushigarg » Mon Jul 08, 2013 7:11 am

Thanks a lot John. This was helpful. :) :D


Return to “PHP coding => General”

Who is online

Users browsing this forum: Bing [Bot], markymark and 3 guests