Re: RE: is there way to pass an array( or variables) to another page without sessions or cookies?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, July 5, 2005 5:20 am, Ross said:
> Can you give me a quick emaple of how this would work, with an array.
>
> I have an array of errors ($errors[]) for a form, when the errors are
> trigger, I am trying to send them to a window which tells them what the
> errrors are. I don't really want to get into sessions or cookies.

How do you want to "send them"?

Do they click on something to get to the errors?

Or are you in the middle of processing your script, and now you think you
want to do a header re-direct?

A header redirect with something like:
<?php
  header("Location:
http://example.com/error.php?errors[]=Redirects+suck&errors[]=Use+include";);
?>
*MIGHT* work...

Of course, you'd want to script the $errors array to get tacked on.

However, GET can be VERY limited in the amount of data transmitted on some
servers, so it would be much safer to just do:

<?php
  if (count($errors)){
    //Display any sort of "masthead" for your site here,
    //Unless you already did that above.
    require 'error_display.inc';
    //DEFINITELY display any sort of "footers"
    //to complement your "masthead" here,
    //because we're about to...
    exit;
  }
?>

error_display.inc can be as simple as:
<?php
  echo "<p class=\"error\">", implode("</p>\n<p class=\"error\">",
$errors), "</p>\n";
?>

Jeez, if it's that simple, why even bother with an include file?...

Only if you plan on using the same error layout all over your site.

-- 
Like Music?
http://l-i-e.com/artists.htm

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux