basic basic question
Posted: Sat Apr 18, 2009 11:16 am
I'm trying to learn php and am using a book by Kevin yank - I've fallen at teh first fence because the examples given do not work. Can anyone please advise as to what is going wrong?
I'm told to make two files
welcome4.html contains the following code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>First name</title>
</head>
<body>
<form action="welcome4.php" method="post">
<label>First name: <input type="text" name="fisrtname" />
</label><br />
<label>last name: <input type="text" name="lastname" />
</label><br />
<input type="submit" value="GO" />
</form>
</body>
</html>
Welcome4.php contains the following code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Untitled 1</title>
</head>
<body>
<?php
$firstname = $_POST[ 'firstname' ];
$lastname = $_POST[ 'lastname' ];
echo "Welcome to our website, $firstname $lastname";
?>
</body>
</html>
Welcome1.html seems to work as a form and I can submit the data.
Welcome4.php simply displays the entire code from that page. I'm stumped. Can anyone please advise? Thank you. Aidan
I'm told to make two files
welcome4.html contains the following code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>First name</title>
</head>
<body>
<form action="welcome4.php" method="post">
<label>First name: <input type="text" name="fisrtname" />
</label><br />
<label>last name: <input type="text" name="lastname" />
</label><br />
<input type="submit" value="GO" />
</form>
</body>
</html>
Welcome4.php contains the following code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Untitled 1</title>
</head>
<body>
<?php
$firstname = $_POST[ 'firstname' ];
$lastname = $_POST[ 'lastname' ];
echo "Welcome to our website, $firstname $lastname";
?>
</body>
</html>
Welcome1.html seems to work as a form and I can submit the data.
Welcome4.php simply displays the entire code from that page. I'm stumped. Can anyone please advise? Thank you. Aidan