Re: Server side issue with <form>

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.          |
`------------------------------------------------------------'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux