Jump to content

How Would I...


Joshua F

Recommended Posts

I am trying to make a tip.php thing, that can be opened in a link and give a top about that page.

 

I am trying to make a default one.

 

Here's my code

<?php
session_start();
include "../includes/connect.php";
include "../includes/config.php";
if(isset($_SESSION['admin2'])){

//Add Page
if($_GET['title'] == 'addpage') {
echo "There is not a tip to this page.";
}
} else { echo "You are not logged in as an administrator."; }
?>

I have tip.php?action=addpage and it will echo that, but I want one that if there isn't a code for, it will do a default saying "There is not a tip for this page".

Link to comment
https://forums.phpfreaks.com/topic/212642-how-would-i/
Share on other sites

Note quite sure I follow you exactly, but you want a new window to popup that will show tips for the page they are on. But not all pages have tips, is that right?

 

If so, you can manually define which pages do not have tips in an array.

 

$no_tips = array('page_title_1','page_title_2','page_title_3');
if(in_array($_GET['title'], $no_tips)){
   echo 'There are no tips to this page.';
}

Link to comment
https://forums.phpfreaks.com/topic/212642-how-would-i/#findComment-1107761
Share on other sites

Note quite sure I follow you exactly, but you want a new window to popup that will show tips for the page they are on. But not all pages have tips, is that right?

 

If so, you can manually define which pages do not have tips in an array.

 

$no_tips = array('page_title_1','page_title_2','page_title_3');
if(in_array($_GET['title'], $no_tips)){
   echo 'There are no tips to this page.';
}

 

I'll just use this, seems easy to use. Thanks.

Link to comment
https://forums.phpfreaks.com/topic/212642-how-would-i/#findComment-1107929
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.