Re: Server side issue with <form>

From: Date: Sun, 10 Jun 2007 20:51:24 +0000
Subject: Re: Server side issue with <form>
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-256567@lists.php.net to get a copy of this message
On Sun, 2007-06-10 at 14:50 -0500, Roy W wrote: > Here is the code: > > index.html > > <html> > <body> > <form action="test.php" method="post"> > Your name: > <input type="text" name="YourName"><BR> > Cost of a lunch: > <input type="text" name="CostOfLunch"><BR> > Days Buying Lunch: > <input type="text" name="DaysBuyingLunch"><BR> > <input type="submit"> > </form> > </body> > </html> > -------------------------------------------- > > index.php > > <? > > $Today = date("1 F d, Y"); > > ?> > > <html> > <body> > Today's Date: > <? > > print("<h3>$Today</h3>\n"); > > print("$YourName, you will be out "); > print($CostOfLunch * $DaysBuyingLunch); > print(" dollars this week.<BR>\n"); > ?> > </body> > </html> > -------------------------------------------- > > Returns: > > Today's Date: > 1 June 10, 2007 > , you will be out 0 dollars this week. You are relying on a deprecated and dangerous feature called "register_globals". It is now disabled by default. You should instead use the following code: -------------------------------------------- > > index.php > > <? > > $Today = date("1 F d, Y"); > > ?> > > <html> > <body> > Today's Date: > <? > > echo "<h3>$Today</h3>\n"; > > echo $_POST['YourName'].", you will be out " ); > echo $_POST['CostOfLunch'] * $_POST['DaysBuyingLunch'] ); > echo " dollars this week.<br />\n" ); > ?> > </body> > </html> > -------------------------------------------- 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 (#256567) next »