My index.html is:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<title></title>
</head>

<body>
<form action="index.php" method="post" name="uandp">
<input type="text" name="user"><br >
<input type="password" name="password">
<input type="submit" value="Go">
</form>
</body>
</html>

My index.php is:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<?php session_start(); ?>

<html>
<head>
	<title></title>
</head>

<body>
<?php
print "Printeo";
echo 'Llego!';
$uservar=_$POST['user'];
echo $uservar;
?>
</body>
</html>

The when I click the button in the html in the form, it goes to the php page but displays the code. When I hit F5, it says it has to send data again to the server and doesnt show any information at all.


Problably something dumb and basic Im missing. I know it works because I put it in my htdocs folder which is by default. PHP also works.

Thanks

Well, _$POST should be $_POST. But that should not display your code. Are you absolutely sure PHP works ?

If you make a file call phpinfo.php with this in it:

<?php
  phpinfo();
?>

What does it show ?

I made it and basically same thing happens: Code is shown.

PHP works as I can access phpMyAdmin perfectly. Also if I go to http://localhost/ ir redirects me to http://localhost/xampp/.Localhost by default is at C:\xampp\htdocs\ I made a folder in there with the html and php files.

I officially believe I am a idiot.....

I was navigating to C: instead of http:// in my browser....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.