Forms in PHP [easy question - please help!]

First of all, why do you go OUT of PHP just to go in it again so shortly after? User something like this:

<?php

$YourName = $_POST['YourName'];
$FavoriteWord = $_POST['FavoriteWord'];

echo $YourName;
echo "<p>You like the word $FavoriteWord !?!</p>";

?>

Here is your old code:

<?php

$_REQUEST['YourName']; //This doesn't really do anything, my guess is you wanted to put it into a var right? thats what I did above since it is easier to type those small vars then the full $_post var every time

$_REQUEST['FavoriteWord']; //same as above nothing happens here

print(" $YourName"); //here you are printing an empty var since $Yourname doesn't exist, it should be $_POST['YourName'] if you wanted to use it directly or it would work if you made the POST vars into normal vars as I did above

?>

<p>
You like the word <b> <?php print(" $FavoriteWord"); ?> !?! // here you out of PHP, why? you can just as easilly do this with php as shown above, and again you are printing a var that doesn't exist, either convert it as I did above or use $_POST['FavoriteWord'] as the var, good luck with it.
</b>



Godiwa
 
well I am a noob/newbie myself too, played with it about 6 months now or so, on and off, and I can only recommend you to get the PHP Manual that can be downloaded on the same page you download PHP itself, and you can get different types of files, and I use the Windows Help File version, very handy and informative and if you got questions about a special command, feel free to ask on this forum, lots of very helpful people here and other then that, go on Amazon.com and look for PHP books, there is a PHP for Beginners (not sure of complete title) but it is a big book with a red cover, I was about to order it but the only version they had in the bookshop where I live was the pro version and I needed the beginner version, and they have them in 3-4 level ranges from beginner up to ultra hardcore coders and you can buy the next level of book when you feel confident in knowing most of the book before it.

When you found it on Amazon then go to your local bookshop and see how much they will charge you for it, usually less then what Amazon does, but they have nice reviews and such over the books

Godiwa
 
Back
Top