Beginner seeking help

Hello,

I am just getting my feet wet in php and I have an issue right of the bat. I have a textbox that the user can enter things into and I want it to print on the other page. The code is just meant for my learning as of right now.

Thanks for all of your help.
I have the following code in a file called post.html
[php]

Enter user name SPEAK:




[/php]

What I was hoping for was that if someone entered John, the script below would display “John”. The code below is in a file called “hiUser.php”. Both files are in the same directory.

I have a disconnect somewhere and I don’t see it.
[php]

User Name <?php $browser = $_SERVER["HTTP_USER_AGENT"]; ?>

You are using the <?php echo($browser);?> web browser.

<? $userName = $_REQUEST["$userName"]; print "

User Name: $userName

"; ?> [/php]

Also, how do I add screen shots. I tried using the image tags but I didn’t get anywhere.

Thank you so much!

Here:

[php]$userName = $_REQUEST["$userName"];[/php]

You are using $userName - asking PHP to replace that with the userName variable (as variable names are parsed inside of speech marks), e.g:

[php]$test = ‘Bob’;

echo “Hello, $test!”;[/php]

Prints:

Hello, Bob!

Just remove the $ in the $_REQUEST.

Sponsor our Newsletter | Privacy Policy | Terms of Service