You are here: Re: sessions headache... « PHP Programming Language « IT news, forums, messages
Re: sessions headache...

Posted by Der tolle Emil on 12/17/16 11:54

"Misteka" <mdemian@lymone.com> schrieb im Newsbeitrag
news:1154435893.733753.51160@p79g2000cwp.googlegroups.com...
> Hi guys,
>
> Here is my code. Redirect to index.php not working. Have trawled
> through old topics but can't fix it.
>
> <?php
>
> session_start();
>
> if (isset($_POST["login"])) {
> $missingfields = array();
>
> foreach ($_POST as $var=>$val) {
> if ($val == "") {$missingfields[$var] = $val;}
> }
>
> if (count($missingfields) > 0) {
> print "You missed out one or more fields:<BR />";
> foreach($missingfields as $key=>$value) {
> print $key . ", ";
> }
> }
> else {
> foreach ($_POST as $key => $value) {
> $_SESSION[$key] = $value;
> }
> session_write_close();
> header("Location: http://shsc-int_staging.brookes.ac.uk/index.php");
> }
> }
> ?>
>
> Any help or assistance appreciated.
>

Usually when header() functions don't work it is because output has already
started. This does throw a warning though if error_reporting is enabled. My
guess is that some output gets send to the browser before the header goes
out; It is also possible that spaces or other characters before or after the
PHP tags (<?php ?>) trigger output before a header gets sent.

 

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

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