RE: [PHP] $_SESSION as $key=$value

2003-06-13 Thread Ralph
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:[EMAIL PROTECTED] 
Sent: Thursday, June 12, 2003 2:40 PM
To: [EMAIL PROTECTED]
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



Re: [PHP] $_SESSION as $key=$value

2003-06-13 Thread Daniel J. Rychlik
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 [EMAIL PROTECTED]
To: 'Daniel J. Rychlik' [EMAIL PROTECTED];
[EMAIL PROTECTED]
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:[EMAIL PROTECTED]
 Sent: Thursday, June 12, 2003 2:40 PM
 To: [EMAIL PROTECTED]
 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



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



RE: [PHP] $_SESSION as $key=$value

2003-06-13 Thread Ralph
I think this may be because you did not include echo in:

value= ?php echo $HTTP_POST_VARS['fname']; ?

so try this:

input name =fname type=text value= ?php echo
$HTTP_POST_VARS['fname']; ?


-Original Message-
From: Daniel J. Rychlik [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 13, 2003 4:28 PM
To: Ralph; [EMAIL PROTECTED]
Subject: Re: [PHP] $_SESSION as $key=$value

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 [EMAIL PROTECTED]
To: 'Daniel J. Rychlik' [EMAIL PROTECTED];
[EMAIL PROTECTED]
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:[EMAIL PROTECTED]
 Sent: Thursday, June 12, 2003 2:40 PM
 To: [EMAIL PROTECTED]
 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




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



Re: [PHP] $_SESSION as $key=$value

2003-06-13 Thread Daniel J. Rychlik
I tried to echo it as well, I recieved the same message.

- Original Message - 
From: Ralph [EMAIL PROTECTED]
To: 'Daniel J. Rychlik' [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Friday, June 13, 2003 6:50 PM
Subject: RE: [PHP] $_SESSION as $key=$value


 I think this may be because you did not include echo in:

 value= ?php echo $HTTP_POST_VARS['fname']; ?

 so try this:

 input name =fname type=text value= ?php echo
 $HTTP_POST_VARS['fname']; ?


 -Original Message-
 From: Daniel J. Rychlik [mailto:[EMAIL PROTECTED]
 Sent: Friday, June 13, 2003 4:28 PM
 To: Ralph; [EMAIL PROTECTED]
 Subject: Re: [PHP] $_SESSION as $key=$value

 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 [EMAIL PROTECTED]
 To: 'Daniel J. Rychlik' [EMAIL PROTECTED];
 [EMAIL PROTECTED]
 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:[EMAIL PROTECTED]
  Sent: Thursday, June 12, 2003 2:40 PM
  To: [EMAIL PROTECTED]
  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
 



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



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



Re: [PHP] $_SESSION as $key=$value

2003-06-13 Thread John Nichel
Change error reporting in the php.ini to NOT include notices.

Echo out the variable

echo ( $_POST['fname'] );

All the notice is telling you is that $HTTP_POST_VARS['fname'] doesn't 
exist, which it isn't if you haven't posted it to this page.

Daniel J. Rychlik wrote:
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 [EMAIL PROTECTED]
To: 'Daniel J. Rychlik' [EMAIL PROTECTED];
[EMAIL PROTECTED]
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:[EMAIL PROTECTED]
Sent: Thursday, June 12, 2003 2:40 PM
To: [EMAIL PROTECTED]
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





--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] $_SESSION as $key=$value

2003-06-13 Thread Lars Torben Wilson
On Fri, 2003-06-13 at 16:28, Daniel J. Rychlik wrote:
 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

This is because when the form is first submitted, nothing has been
submitted, and thus $HTTP_POST_VARS['fname'] has no value. PHP is
simply warning you that you're trying to use an unitialized value.

Check the value first and you'll not have a problem with it:

?php
$output_fname = isset($_POST['fname']) ? $_POST['fname'] : '';
?
input name =fname type=text value=?php echo $output_fname ? /

If the first line looks odd, check out:

   http://ca2.php.net/manual/en/language.expressions.php

You could just turn down your error reporting, but all that does is
hide from you the fact that you're using code with problems in it. You
should make sure the code executes in a development environment with
full error reporting on without warnings or notices, before you turn off
error display on the production box.


Torben

 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 [EMAIL PROTECTED]
 To: 'Daniel J. Rychlik' [EMAIL PROTECTED];
 [EMAIL PROTECTED]
 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:[EMAIL PROTECTED]
  Sent: Thursday, June 12, 2003 2:40 PM
  To: [EMAIL PROTECTED]
  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
 
-- 
 Torben Wilson [EMAIL PROTECTED]+1.604.709.0506
 http://www.thebuttlesschaps.com  http://www.inflatableeye.com
 http://www.hybrid17.com  http://www.themainonmain.com
 - Boycott Starbucks!  http://www.haidabuckscafe.com -




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