PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
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  
Old September 17th, 2002, 05:10 AM
Carol Carol is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Sunshine Coast Australia
Posts: 23 Carol User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old September 17th, 2002, 05:31 AM
atakmim atakmim is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 1 atakmim User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: Echo Statement Problem

First: <? php is wrong, must be <?php
Second: in php.ini file register_globals = On

Reply With Quote
  #3  
Old September 17th, 2002, 06:55 AM
neutcomp neutcomp is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: weesp, N-H, The Netherlands
Posts: 14 neutcomp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: Echo Statement Problem

You can find the php.ini file in you c:windows directory.

Good luck.
Bjorn

Reply With Quote
  #4  
Old September 17th, 2002, 02:34 PM
notepad notepad is offline
Codewalkers Loyal (3000 - 3499 posts)
 
Join Date: Apr 2007
Location: Central, IL USA
Posts: 3,214 notepad User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Send a message via AIM to notepad
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']

Reply With Quote
  #5  
Old September 17th, 2002, 09:12 PM
Carol Carol is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Sunshine Coast Australia
Posts: 23 Carol User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #6  
Old September 17th, 2002, 10:29 PM
notepad notepad is offline
Codewalkers Loyal (3000 - 3499 posts)
 
Join Date: Apr 2007
Location: Central, IL USA
Posts: 3,214 notepad User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Send a message via AIM to notepad
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";

Reply With Quote
  #7  
Old September 18th, 2002, 03:01 AM
Carol Carol is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Sunshine Coast Australia
Posts: 23 Carol User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: Echo Statement Problem

Still a no-go Notepad. I tried each alternative you suggested. Thanks for trying though.

Reply With Quote
  #8  
Old September 18th, 2002, 01:27 PM
notepad notepad is offline
Codewalkers Loyal (3000 - 3499 posts)
 
Join Date: Apr 2007
Location: Central, IL USA
Posts: 3,214 notepad User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Send a message via AIM to notepad
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");

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > Echo Statement Problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway