homepage Welcome to WebmasterWorld Guest from 54.237.98.229
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / WebmasterWorld / Webmaster General
Forum Library, Charter, Moderators: phranque

Webmaster General Forum

    
Very strange Browser output
godfrey tan2001



 
Msg#: 4581467 posted 2:00 pm on Jun 5, 2013 (gmt 0)

Hi,

Here are my codes:
test1.html

<!doctype html>

<html lang="en">

<head>
</head>

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

</body>
</html>

welcome.php
Welcome <?php echo $_POST["fname"]; ?>!<br>
You are <?php echo $_POST["age"]; ?> years old

Output on browser
Welcome <?php echo $_POST["fname"]; ?>!<br>
You are <?php echo $_POST["age"]; ?> years old

Browser URI
file:///C:/xampp/htdocs/welcome.php


I am running XAMPP with Apache server. Seems like parameters from form not passed to welcome.php file.

Do you know what is the matter?

 

Fotiman

WebmasterWorld Senior Member fotiman us a WebmasterWorld Top Contributor of All Time 5+ Year Member



 
Msg#: 4581467 posted 2:31 pm on Jun 5, 2013 (gmt 0)

file:///

You're accessing the file directly instead of through your Apache server. You need to access via http:// and point it at your server, otherwise no server side processing can happen.

godfrey tan2001



 
Msg#: 4581467 posted 2:53 pm on Jun 5, 2013 (gmt 0)

Hi Fotiman,

If my XAMPP default directory is c:\xampp\htdocs. How do I convert this to http for welcome.php?

Can you just give me an example?

Godfrey

godfrey tan2001



 
Msg#: 4581467 posted 3:05 pm on Jun 5, 2013 (gmt 0)

Hi Fotiman,

Thank you very much for your reply. Much appreciated...

Godfrey

Fotiman

WebmasterWorld Senior Member fotiman us a WebmasterWorld Top Contributor of All Time 5+ Year Member



 
Msg#: 4581467 posted 3:19 pm on Jun 5, 2013 (gmt 0)

So, if it's running as a server, then you would probably do something like
http://localhost/test1.html (depends on how you've configured it and if you're in a subdirectory, etc.)

lucy24

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4581467 posted 8:49 pm on Jun 5, 2013 (gmt 0)

If it behaves approximately the same as MAMP, you need to go into its preferences --or whatever your platform calls them-- and select a default directory.

You can never open the file directly from your desktop; it has to be done within the browser. Make a "WAMP site" or similar bookmark and you won't have to memorize the URL. (Mine's http:/ /localhost:8888/ That's the free version, where you can only use one domain at a time. I think the fancier version comes with a pseudo-DNS so you can do multiple domains.)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / WebmasterWorld / Webmaster General
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved