Page 1 of 1

Isset problem ... !

Posted: Thu Sep 12, 2002 2:27 am
by Skywalker
I have a small problem. The script must first control if the of the user is fild in. If not the user is send back to the mayne page to fill in his namen.

If the name is set and sended to the cookie, the name must be appear auto.

The problem is, when you are filling in your name, it doesn't make a cookie. But it gose to right page. and doesn't send the people back to fill in ther names. The mayne problem is that the cookie isn't been made.

Here is my litle script.

if (isset($_POST['NewNaam'])) {
$Naam=$_POST['NewNaam'];

if (isset($_COOKIE['Naam'])) {
$Naam =($_COOKIE['Naam']);
echo '' ;
} else {
$cookieset = setcookie('Naam', $NewNaam, time()+43200);
if (!empty($cookieset)) {
$Naam = $NewNaam;
echo '';
} else {
echo 'error - cookie could not be set';
}
}


} else {
echo ("<META HTTP-EQUIV=\"refresh\" content=\"2;URL=index.php\">\n");
}


Thx you all, Skywalker

Posted: Thu Sep 12, 2002 2:57 am
by dusty

Code: Select all

if(isset($_COOKIE&#1111;'Naam'])) {
  $Naam = $_COOKIE&#1111;'Naam'];
} elseif(isset($_POST&#1111;'NewNaam'])) {
  $Naam = $_POST&#1111;'NewNaam'];
  setcookie("Naam", $NewNaam, time()+43200);
} else {
  header("location: index.php");
}

Posted: Thu Sep 12, 2002 3:16 am
by Skywalker
This script doesn't work correctly, it doesn't make eny cookie?
Do I have to replace al of the old script or just a pease?

Tell me.

Posted: Thu Sep 12, 2002 9:19 am
by phice

Code: Select all

&lt;?php
if(isset($_COOKIE&#1111;'Naam'])) { 
  $Naam = $_COOKIE&#1111;'Naam']; 
} elseif(isset($_POST&#1111;'NewNaam'])) { 
  $Naam = $_POST&#1111;'Naam']; 
  setcookie("Naam", $Naam, time()+43200); 
} else { 
  header("location: index.php"); 
}
?&gt;