Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • EspaƱol
      • FranƧais
      • PortuguĆŖs
  • ę—„ęœ¬čŖžć‚³ćƒŸćƒ„ćƒ‹ćƒ†ć‚£
  • ķ•œźµ­ ģ»¤ė®¤ė‹ˆķ‹°
0

Help with "else" option in if (isset($_COOKIE["super_secret_user"]))

Explorer ,
Jan 16, 2011 Jan 16, 2011

I am trying to have my index.php make a choice as to what it shows. I would like it to open a new page (index1.php) at the "else" Is this possible? And if it is... can someone show me the code to use.

Condition 1 welcomes the user (done)

Condition 2 opens  a log in page (need help)

Thank you for your time.

TOPICS
Server side applications
716
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jan 25, 2011 Jan 25, 2011

Yes it is possible.

If you paste your code or URL, i can tell you how.

Depending on where the "else" statement occurs in your code you may either use:

<meta http-equiv='refresh' content='0; URL=index1.php'> // Only works if no headers are sent already

or you just call different content in the same index.php (that's why we have a dynamic page)

As long as the html content is wedged between the <?php if... { ?> and <? } else { ?>" statements it'll do.

The alternative content then after the "else" and you're good.

Don't forget the closing brackets in the end - <? } ?>

cheers,

ff

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 27, 2011 Jan 27, 2011
LATEST

Thanks fun factory for getting back to me on this. With much frustration and learning. I have resolved my problem.

Initially because I could not get this to work  header("Location: http://domain.com/index3.php"); I used include("index3.php"); That too led to issues so.. I figured out the problem with using the "header" command to jump to an alternate page and have it sort of working the way I want now

Thanks again for your offer to help

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines