[PHP] self processing forms

2002-06-10 Thread Bill Hudspeth

I am using the O'Reilly "Programming PHP" manual, and have copied the code
from Example 7.3, p. 166. I have the magic_quotes_gpc set to ON in php.ini
(though toggling between on and off doesn't seem to have any effect). My
processed form reports "0.00F is -17.78C " regardless of the initial
fahrenheit temperature I enter. Moreover, using another version of this
script, as shown in Example 7.4, p. 167, simply clears the text field, and
never returns an output. I can't figure out why I am not getting a correct
output - perhaps something in my php.ini file? A copy of the code I am using
(Example 7.3) is as follows:




Untitled







Fahrenheit temperature:








**

Thanks much in advance, Bill





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




Re: [PHP] self processing forms

2002-06-10 Thread Jason Soza

Are you restarting Apache (or whatever webserver you're using) between 
edits to php.ini? I assume since you also posted this to php-win that 
you're using Win32. This would be my first step if you haven't done so 
already.

I got corrected on this before, saying that you -don't- have to restart 
between edits, but trust me, you do. I made changes to php.ini, saved, 
and no changes were noted until AFTER I restarted Apache. Apache does 
parse php.ini on startup because I entered invalid pathnames in various 
places as a test, and only on restart did I get a notice that the 
pathnames were invalid.

I'm using Win32, PHP v4.1.2 as a module (not CGI), Apache 1.3.something.

Jason Soza

- Original Message -
From: "Bill Hudspeth" <[EMAIL PROTECTED]>
Date: Monday, June 10, 2002 2:16 pm
Subject: [PHP] self processing forms

> I am using the O'Reilly "Programming PHP" manual, and have copied 
> the code
> from Example 7.3, p. 166. I have the magic_quotes_gpc set to ON in 
> php.ini(though toggling between on and off doesn't seem to have 
> any effect). My
> processed form reports "0.00F is -17.78C " regardless of the initial
> fahrenheit temperature I enter. Moreover, using another version of 
> thisscript, as shown in Example 7.4, p. 167, simply clears the 
> text field, and
> never returns an output. I can't figure out why I am not getting a 
> correctoutput - perhaps something in my php.ini file? A copy of 
> the code I am using
> (Example 7.3) is as follows:
> 
> 
> 
> 
> Untitled
> 
> 
> 
> 
>  if ($_SERVER['REQUEST_METHOD'] == 'GET'){
> ?>
> 
> 
> Fahrenheit temperature:
> 
> 
> 
>  } elseif ($_SERVER['REQUEST_METHOD'] == 'POST') {
> $fahr=$_POST['fahrenheit'];
> $celsius=($fahr - 32) * 5/9;
> printf("%.2fF is %.2fC", $fahr, $celsius);
> //echo "The temperature in degrees celsius is $celsius";
> } else {
> die("This script only works with GET and POST requests.");
> }
> ?>
> 
> 
> 
> 
> **
> 
> Thanks much in advance, Bill


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




Re: [PHP] self processing forms

2002-06-10 Thread Analysis & Solutions

Bill:

On Mon, Jun 10, 2002 at 04:16:48PM -0600, Bill Hudspeth wrote:
> I am using the O'Reilly "Programming PHP" manual, and have copied the code
> from Example 7.3, p. 166.

You didn't copy it correctly.  See below.


> I have the magic_quotes_gpc set to ON in php.ini
> (though toggling between on and off doesn't seem to have any effect).

Because you'll only see a difference if your submission has something in 
it that needs to be escaped.  For example ' " will have slashes added to 
them.


>  
   
By the way, allow me to point something out that doesn't have anything to
do with your script not working, but may come in helpful in the future.  
You mean "value" not "name."  Name is what the name of the variable
becomes.  Value is the data that the variable holds and what's visible
when you look at the form in your web browser.  I suspect the button is
supposed to say "Convert to Celsius!" in it rather than the default
"Submit Query."

Enjoy,

--Dan

-- 
   PHP classes that make web design easier
SQL Solution  |   Layout Solution   |  Form Solution
sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

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