Re: Problem with form

From: Date: Wed, 07 Jun 2006 05:23:05 +0000
Subject: Re: Problem with form
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-237531@lists.php.net to get a copy of this message
On Wed, 2006-06-07 at 01:14, Rodrigo de Oliveira Costa wrote: > Guys I'm getting the following problem: > > I have a form that asks for one variable that goes into the input box, > this box is named chapter, and the box is in a form that is submited > to another php, and this php should receive this variable and I should > be abble to access it thru $chapter, but when I try to use the > variable $chapter I get the following error: > > Notice: Undefined variable: chapter in c:\arquivos de > programas\easyphp1-8\www\teste.php on line 6 > > This variable is concatenated into a string and is used to retrieve a > certain page from a domain, if I initialize the variable in the second > php script it goes ok, but if I try to use the one that should be > passed thru the form I get the error above. Does anybody know what I'm > doing wrong? > > The second script is bellow so you can understand my problem thank you guys: > > <? > //$chapter = 1; > $urlChapter = '/'.$chapter.'/'; > $url = ":þ÷ > „ÿ‹…‚‰9©’http://www.domain.com/s/2784825"."$urlChapter"; > $texto = file("$url"); > $result2 = count($texto); > $i = 0; > while ($i < $result2) > { > echo "$texto[$i]"; > $i++; > } > ?> You are relying on register_globals being set to on. Instead use the more secure method of retrieving your submitted data from $_GET or $_POST (depending on which "method" your form is set to use). You can also use $_REQUEST if you don't care from whence the data was submitted (but you should care :). Cheers, Rob. -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------'

« previous php.general (#237531) next »