[PHP] $_POST trouble with html form

2004-02-08 Thread Paul Furman
Why am I getting the error Undefined index: comment?

It's probably a typo because I had something similar that worked.

form action=?php include (ACTION_DIR./jpeg-comment.php); ? 
method=post
textarea name=comment ROWS=6 COLS=60
  ?php print $comments[$thumb_num] ?
/textareabr
input type=submit value=update annotation
/form
?php
echo $_POST[comment]; # this is just for debugging
?

Also perhaps related, when I call $_POST[comment] in the action file, 
it gives me Forbidden You don't have permission to access...[error 
message] but this is my own server at home. I'm quite unfamiliar with 
forms (and new to PHP for that matter).

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


Re: [PHP] $_POST trouble with html form

2004-02-08 Thread Adam Bregenzer
On Sun, 2004-02-08 at 13:15, Paul Furman wrote:
 Why am I getting the error Undefined index: comment?
 
 It's probably a typo because I had something similar that worked.
 
 form action=?php include (ACTION_DIR./jpeg-comment.php); ? 
 method=post
  textarea name=comment ROWS=6 COLS=60
?php print $comments[$thumb_num] ?
  /textareabr
  input type=submit value=update annotation
 /form
  ?php
  echo $_POST[comment]; # this is just for debugging
  ?

You will not have access to the $_POST[comment] variable until the
form is submitted.  It looks like you are trying to access this when the
form is loaded.  Whatever action is echoed in the jpeg-comment.php
script is where you want to use you comment variable.

 Also perhaps related, when I call $_POST[comment] in the action file, 
 it gives me Forbidden You don't have permission to access...[error 
 message] but this is my own server at home. I'm quite unfamiliar with 
 forms (and new to PHP for that matter).

That looks like an access error from your web server.  Make sure the
directory this file is in is accessible from the web.

-- 
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/

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



Re: [PHP] $_POST trouble with html form

2004-02-08 Thread Paul Furman
Adam Bregenzer wrote:

Also perhaps related, when I call $_POST[comment] in the action file, 
it gives me Forbidden You don't have permission to access...[error 
message] but this is my own server at home. I'm quite unfamiliar with 
forms (and new to PHP for that matter).


That looks like an access error from your web server.  Make sure the
directory this file is in is accessible from the web.
No, it's not accessible from the web, it's in my protected php_library 
outside public_html. Can't I execute a hidden script with a form? Should 
I make a little php action file in public_html that includes the actual 
file?

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


Re: [PHP] $_POST trouble with html form

2004-02-08 Thread Paul Furman
Paul Furman wrote:

Adam Bregenzer wrote:

Make sure the
directory this file is in is accessible from the web.


No, it's not accessible from the web, it's in my protected php_library 
outside public_html. 


It does load the protected action file as long as I don't try to call 
$_POST[comment]

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


Re: [PHP] $_POST trouble with html form

2004-02-08 Thread Adam Bregenzer
On Sun, 2004-02-08 at 13:32, Paul Furman wrote:
 No, it's not accessible from the web, it's in my protected php_library 
 outside public_html. Can't I execute a hidden script with a form?

no

 Should 
 I make a little php action file in public_html that includes the actual 
 file?

yes

-- 
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/

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



Re: [PHP] $_POST trouble with html form

2004-02-08 Thread Paul Furman
Adam Bregenzer wrote:

Should I make a little php action file in public_html
that includes the actual file?


yes
OK thanks, I made this:

?php
  # jpeg-comment-public.php
 include (C:/_Paul/web/phplib/action/jpeg-comment.php);
?
but now the hidden one isn't aware of any variables.

Forbidden
You don't have permission to access
Notice: Undefined variable: thumb_num in 
C:/_Paul/web/phplib/action/jpeg-comment.php on line 4

etc...

on this server.

Apache/1.3.29 Server at 127.0.0.1 Port 80
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] $_POST trouble with html form

2004-02-08 Thread Paul Furman
Adam Bregenzer wrote:
You will not have access to the $_POST[comment] variable until the
form is submitted.  
Understood. That debug test only worked after submitting the form.

So maybe the better way is to just submit the form with the action file 
simply reloading the main page to refresh it then put my code below with 
an if statement checking if the form has been submitted yet and clearing 
$_POST when I'm done.

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


Re: [PHP] $_POST trouble with html form

2004-02-08 Thread Adam Bregenzer
On Sun, 2004-02-08 at 13:58, Paul Furman wrote:
 OK thanks, I made this:
 
 ?php
# jpeg-comment-public.php
   include (C:/_Paul/web/phplib/action/jpeg-comment.php);
 ?
 
 but now the hidden one isn't aware of any variables.
 
 Forbidden
 You don't have permission to access
 Notice: Undefined variable: thumb_num in 
 C:/_Paul/web/phplib/action/jpeg-comment.php on line 4

Where are these variables coming from?  The action in your form should
be a url that points to the script you want to process the form.  In
that script you access the form variables by $_POST['variable_name']. 
IE:

form.html:
form method=post action=process.php
input type=text name=comment /
/form

process.php:
?php
echo $_POST['comment'];
?

-- 
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/

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