$output_fname = (isset($HTTP_POST_VARS['fname'])) ? $HTTP_POST_VARS['fname']
: '';
but the value WILL be set regardless... in this case i'd prefer:
if(isset($HTTP_POST_VARS['fname'])) { $output_fname =
$HTTP_POST_VARS['fname']; }
alternatively, I wrote a nice function to pluck out $_POST vars only if
they're set. you could easily modify it to do $HTTP_POST_VARS instead of
$_POST
http://www.weberdev.com/get_example.php3?count=3662
Justin
on 15/06/03 10:44 AM, Daniel J. Rychlik ([EMAIL PROTECTED]) wrote:
> Why is my script autopopulating a "1" in the field names and not the orginal
> values ?
> Is it something to do with this statement ?
> $output_fname = isset($HTTP_POST_VARS['fname']);
>
> Im declaring the var and using it in value field in my form. I know that I
> missing something. Its returning true when value is entered or when its not
> and placing a nice 1 in every field of my form.
>
> Im thinking
> $output_fname = isset($HTTP_POST_VARS['fname']) ? $HTTP_POST_VARS['fname']
> is the answer and ive tried for several hours to fix it.
>
> -dan
>
> ----- Original Message -----
> From: "Daniel J. Rychlik" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Saturday, June 14, 2003 4:54 PM
> Subject: [PHP] isset()
>
>
> Having a bit of trouble with my forms returnin 1 in the form fields accept
> the data that was entered. I think its because of this line,
>
> $output_fname = isset($HTTP_POST_VARS['fname']);
>
> I have a command action handler also that works in the same script and it
> seems to work well, the only problem that Im having is passing back the
> error to the related filed that requires proper data. I started just
> passing back a generic message so that I could get the routine down, once I
> get that I will be able to do more.
>
> Here is a snipit of my code.
> <head>
> <?php if ($has_errors) { ?>
>
> Please fix your errors
>
> <?php foreach($errors as $val) {
>
> echo $val; } ?>
> <?php } else { ?>
>
> Please fill out form.
> <?php } ?>
>
> <form .....
> HTML STUFF.
>
> </form>
>
> <?php
>
> if (count($errors)) $has_errors = true; // If we find errors,
> then flag
> if ($has_errors) $command ="data_check" // Take us back to
> the data_check hidden field and set $has_errors
> true to display our errors at the top of our
> form.
>
> ?>
> <head>
> This is really a 2 question issue, and I greatly appreicate you're time.
> This is my 2nd week learning PHP...
>
> Thanks in advance,
> Dan
>
>
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php