You are here: Re: [PHP] RE: is there way to pass an array( or variables) to another page without sessions or cookies? « PHP « IT news, forums, messages
Re: [PHP] RE: is there way to pass an array( or variables) to another page without sessions or cookies?

Posted by "Richard Lynch" on 11/13/59 11:21

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация