Re: $_POST trouble with html form

From: Date: Sun, 08 Feb 2004 18:25:55 +0000
Subject: Re: $_POST trouble with html form
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-177158@lists.php.net to get a copy of this message
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] ?> > </textarea><br> > <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 adam@bregenzer.net http://adam.bregenzer.net/

« previous php.general (#177158) next »