ignaton Posted January 22, 2009 Share Posted January 22, 2009 I'm just a begun coding but seem to have a problem with php code being read from html. Basically my php is not being read correctly as far as I can tell. I have pasted my code(gotten from a tutorial) below and below that is the results in my browser window. Source --- <html> <head> <title>My First PHP Page</title> </head> <body> <h1>Hello </h1> <?php echo "Hello World!"; ?> </body> </html> Results ------------ Hello If I put the php in a file it also doesn't work properly as shown below. HTML Code ---------- <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> Welcome.php code -------- <html> <body> Welcome <?php echo $_POST["name"]; ?>.<br /> You are <?php echo $_POST["age"]; ?> years old. </body> </html> Results --------- Welcome . You are years old. The problem appears both with WAMP and XAMPP installs (I couldn't get apache/php/mysql to work when installed separately) so I not sure whether I have an install issue(I have attempted multiply reinstall's) or it a coding problem, though I consulted numerous tutorials and nothing has worked for me. I sorry if this is not in the correct section to be posting this question. Thanks of course for any replies. Link to comment https://forums.phpfreaks.com/topic/141892-php-being-read-from-html-problem/ Share on other sites More sharing options...
haku Posted January 22, 2009 Share Posted January 22, 2009 Your code looks fine, so its probably a bad install of php. Link to comment https://forums.phpfreaks.com/topic/141892-php-being-read-from-html-problem/#findComment-742983 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.