Re: $_SESSION as $key=>$value
| From: | Daniel J. Rychlik | Date: | Fri, 13 Jun 2003 23:28:28 +0000 |
| Subject: | Re: $_SESSION as $key=>$value | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-151438@lists.php.net to get a copy of this message | ||
I read the document 4 times. I understand how it works and now Im excited
about applying this to my application, however Im running into a problem.
Im recieving an error on my page.
I have this in my form.
<input name ="fname" type="text" value=" <?php
$HTTP_POST_VARS['fname']; ?>"
/>
and when running, I recieve
Notice: Undefined index: fname
I also used the example from here
http://www.zend.com/zend/spotlight/form-pro-php4.php
and I recieved the same
message.
Any Ideas, to help me break through these barriers?
Thanks so much
Dan
----- Original Message -----
From: "Ralph" <ralph@nqionline.com>
To: "'Daniel J. Rychlik'" <drychlik@tcsconsult.com>;
<php-general@lists.php.net>
Sent: Friday, June 13, 2003 1:50 AM
Subject: RE: [PHP] $_SESSION as $key=>$value
> Daniel,
>
> Rather than sending them to a new page to validate the form and then
> sending them back if a field is invalid, do the error checking from the
> same script.
>
> Here's an example, a bit simple but just to give you an idea.
>
> For a better explanation, you should read this article which elaborates
> on this method:
>
> http://www.zend.com/zend/spotlight/form-pro-php4.php
>
>
> <?php
>
> if($HTTP_POST_VARS){
>
> // check for required fields
> if(!HTTP_POST_VARS['name'] || !HTTP_POST_VARS['email'])
> $error_message = 'You did not provide all required fields'
> }
>
> // any other error checking you want to do
> ....
> ?>
>
>
> <?php
>
> // if error, print out error message
> if($error_message){
> echo $error_message;
> }
>
> ?>
>
> <FORM METHOD="post" ACTION="<?php echo $PHP_SELF ?>">
> <INPUT TYPE="text" NAME="name" SIZE="20" VALUE="<?php
> echo
> $HTTP_POST_VARS['name'] ?>">
> <INPUT TYPE="text" NAME="email" SIZE="20" VALUE="<?php
> echo
> $HTTP_POST_VARS['email'] ?>">
> and so on....
>
> <INPUT TYPE="submit" NAME="process_form" VALUE="Submit">
>
> -----Original Message-----
> From: Daniel J. Rychlik [mailto:drychlik@tcsconsult.com]
> Sent: Thursday, June 12, 2003 2:40 PM
> To: php-general@lists.php.net
> Subject: [PHP] $_SESSION as $key=>$value
>
> Is this valid to iterate over a form variables.?
>
> foreach ($_SESSION as $key=>$value)
>
> and another question, do I need this <form action="scripts/process.php"
> method="post"> in my form?
>
> Im really struggling with $_SESSION. Im trying to program smarter and
> make friendlier applications.
>
> Ive submitted several emails dealing with this function and I apologize
> for beating a dead horse, so to speak.
>
> I have a form with a few form fields. Im working on an error function
> that will take the data that was entered and pass it back to the form so
> that the user will not have to input the data again. If an error is
> found I use the header function to go back to the form. Im having
> trouble with passing back the data. Do I in my form setup a $_GET or
> should I use the $_SESSION to call it. I am also going to setup a few
> css styles that highlight which field was found in error.
>
> Again, I apologize for my lack of vision and maybe a spark of light will
> go off, and I will be able to make some connections to get this done.
>
> Dan
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>