Jump to content

What am I missing?


newuserphp

Recommended Posts

Hello,

 

I just started teaching myself PHP

 

I've only been doing it for 3 days now

 

Today, I hit a barrier : I am using an online tutorial, and I came across this example HTML code :

 

 

<!DOCTYPE html>

<html>

<head>

<title>My Form</title>

</head>

<body>

 

<form action="TestFile.php" method=post>

 

My name is:

<br> <input type="text" name="YourName">

 

My favorite word is:

<br /><input type="text" name="FavoriteWord">

 

<input type="submit" name="submit" value="Here we go !">

</form>

</body>

</html>

 

 

 

Ok, that's the HTML form. And here is the PHP file "TestFile.php"

 

 

 

<html>

<head>

<title>My Output!</title>

</head>

 

<?php

 

// Capture the values posted to this php program from the text fields

// which were named 'YourName' and 'FavoriteWord' respectively

 

$YourName = $_REQUEST['YourName'] ;

$FavoriteWord = $_REQUEST['FavoriteWord'] ;

?>

 

<body bgcolor="#FFFFFF" text="#000000">

<p>

 

Hi <?php print $YourName; ?>

 

<p>

You like the word <b> <?php print $FavoriteWord; ?>??</b>

 

<p>That is a nice word. Well done!

 

</body>

</html>

 

 

 

 

But, it's not working. The HTML form works fine, it inputs the info. But, when I click "Submit", the PHP file does not provide the output

 

It shows the statements, ok. But, the "name" and "favorite word" fields are blank. It shows nothing.

 

Everything is exactly as stated in the Online Tutorial. So, I know I did not miss anything.

 

But, why is the output not being displayed?

 

Thanks

 

Link to comment
https://forums.phpfreaks.com/topic/294377-what-am-i-missing/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.