PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old April 10th, 2005, 09:44 PM
SAPSAP SAPSAP is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 1 SAPSAP User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 11 sec
Reputation Power: 0
"I'm learning PHP, I need have small request. HELP!

I'm getting an error from a very simple page I learned. These are the 2 forms I made: The 1st
is called "searchbyresults.html" and the 2nd one is called "byresults.php". I can't get the simple result that I'm
looking for. When I enter data and press the search button it says "Notice: Undefined variable: name in C:\Program Files\Apache Group\Apache2\htdocs\test\byresults.php on line 4

1st form:


<HTML>
<HEAD>
<TITLE>Vinyl Dealers: search</TITLE>
</HEAD>
<BODY>
<H2>Search for a shop</H2>
<BR>
<FORM ACTION="byresults.php" METHOD="POST">
Please enter the name, or part of the name, of the shop you are seeking:
<BR>
<INPUT NAME="name" TYPE=TEXT>
<BR>
<INPUT TYPE=SUBMIT VALUE="search">
</FORM>
</BODY>
</HTML>



2nd form:


<?
echo $name;
?>

Reply With Quote
  #2  
Old April 11th, 2005, 12:39 AM
Damann Damann is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 15 Damann User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 49 m 8 sec
Reputation Power: 0
i think that register_globals isn't on on your server
you need to use echo "{$_GET['name']}"

Reply With Quote
  #3  
Old April 12th, 2005, 12:35 PM
sevenseeker sevenseeker is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 5 sevenseeker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 5 m 51 sec
Reputation Power: 0
I tested this code on my own server and it works fine. I agree with Damann.

Reply With Quote
  #4  
Old April 13th, 2005, 08:56 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,886 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 19 m 35 sec
Reputation Power: 18
Best practice dictates that you should assume register_globals will always be turned off...
Always use the $_GET and $_POST variables as they work whether it's off or on.

Reply With Quote
  #5  
Old April 14th, 2005, 01:37 AM
Itsacon's Avatar
Itsacon Itsacon is offline
Command Line Warrior
Click here for more information
 
Join Date: Aug 2004
Location: Sector ZZ9 Plural Z Alpha
Posts: 1,029 Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)  Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6
Time spent in forums: 1 Week 12 h 55 m 59 sec
Reputation Power: 15
Send a message via ICQ to Itsacon
Quote:
Originally Posted by Damann
i think that register_globals isn't on on your server
you need to use echo "{$_GET['name']}"



Since his form uses method="post", I think $_POST['name'] would work better.
__________________
This is my code. Is it not nifty?

"The biggest problem encountered while trying to design a system that was completely foolproof, was, that people tended to underestimate the ingenuity of complete fools."
---Douglas Adams


Join the Itsacon fanclub!    
Zero Tolerance: Spammers banned so far: 592

Reply With Quote
  #6  
Old April 14th, 2005, 12:16 PM
Damann Damann is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 15 Damann User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 49 m 8 sec
Reputation Power: 0
o, i see now, excuse me
echo "{$_POST['name']}";

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > "I'm learning PHP, I need have small request. HELP!


Developer Shed Advertisers and Affiliates


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 | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap