-entropyman Posted June 28, 2008 Share Posted June 28, 2008 Hello all, as you can tell i am still very new at php. i am learning from a book i bought. now i have run across a problem and would like your help. i am just doing the simple hi user exercise but i cannot figure out what is going wrong. i enter a name in the text field and hit submit but on the next page it just says "Hi there, !" http://entropy.vndv.com/learning/chapter_2/whatsName.html as you can see you still enter a name in the text field and hit submit but on the next page it just says "Hi there, !" any ideas? thank you Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted June 28, 2008 Share Posted June 28, 2008 Without seeing the code you are using, its a bit difficult to help you there. Double check that you've not made a mistake with your variable, and note that it is case sensitive. You could have something like: $userName = $_POST['userName']; If you're still stuck, we need to see your code. Dont forget to place tags around it. p.s. Welcome to the forum Quote Link to comment Share on other sites More sharing options...
-entropyman Posted June 28, 2008 Author Share Posted June 28, 2008 well thank you mate, but i now get this error Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /www/vndv.com/e/n/t/entropy/htdocs/learning/chapter_2/hiUser.php on line 11 before i was just using $userName - the code i am testing is straight outta my learning book. here is the code <html> <head> <title>Hi User</title> </head> <body> <h1>Hi User</h1> <h3>PHP program that receives a value from "whatsName"</h3> <script language = "php"> print "<h3>Hi there, $_POST['userName']!</h3>"; </script> </body> </html> any ideas? thanks in advance and thank you for the welcome Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted June 28, 2008 Share Posted June 28, 2008 The book you're using assumed that global variables are turned on which hasn't been the default for over 5 years. If you had posted the original script, then we could have given you the correct line. You need to do <?[php print "<h3>Hi there, {$_POST['userName']}!</h3>"; ?> Also the more accepted way of entering/exiting PHP code blocks is with "<?php ?>", not "<script language = "php"> </script>". Please buy a more up to date book. If you learn from the one you have, you will probably learn old & insecure programming methods. Ken Quote Link to comment Share on other sites More sharing options...
phpzone Posted June 28, 2008 Share Posted June 28, 2008 Other than a book I also strongly recommend: http://hudzilla.org/phpwiki/index.php?title=Main_Page Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.