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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.