|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Echo Statement Problem
Can someone please help. I am working through a PHP for Beginners book and while I believe I have typed the code EXACTLY as it says in the book, my echo statements don't work at all. Here is the code for the HTML document that passes the variable:
<html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#FF0066" text="#000000"> <form method = "post" action= "p-6-1.php"> Enter a numeric value: <BR> <input type = "text" name = "number"> </form> </body> </html> Here is the code for the php form: <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#ffcc33" text="#000000"> <? php echo "The number entered was: $number"; if ($number > 10) echo"<BR>That's a big number"; ?> </body> </html> I would appreciate any help. Thanks Carol |
|
#2
|
|||
|
|||
|
RE: Echo Statement Problem
First: <? php is wrong, must be <?php
Second: in php.ini file register_globals = On |
|
#3
|
|||
|
|||
|
RE: Echo Statement Problem
You can find the php.ini file in you c:windows directory.
Good luck. Bjorn |
|
#4
|
|||
|
|||
|
RE: Echo Statement Problem
well you SHOULD leave register globals off for security reasons.. just change the way you're accessing your variables.
instead of $number, use $_POST['number'] |
|
#5
|
|||
|
|||
|
RE: Echo Statement Problem
Notepad
It didn't like that idea. It gave a parse error expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' Any other suggestions? Thanks Carol |
|
#6
|
|||
|
|||
|
RE: Echo Statement Problem
that just sounds like it wasn't formatted properly. any of the following should work.
echo "The number entered was: $_POST['number']"; or echo "The number entered was: $HTTP_POST_VARS['number']"; or $number = $POST['number']; echo "The number entered was: $number"; |
|
#7
|
|||
|
|||
|
RE: Echo Statement Problem
Still a no-go Notepad. I tried each alternative you suggested. Thanks for trying though.
|
|
#8
|
|||
|
|||
|
RE: Echo Statement Problem
that doesn't sound right..
add the following lines to your php code and tell me what output do you get (after you submit your html form) echo "$REQUEST_METHOD<br>n"; print_r("$HTTP_POST_VARS"); |
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > Echo Statement Problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|