Jump to content

php to display message


dev1902

Recommended Posts

I have 3 pages. I am concerned with the first and second page.

 

Basically, The first page populates two text fields with the same data straight from a database.

  >>You have an option to compare two things. 

  >>When you click submit

  >>The information requested is displayed on page 2 in a table with different columns displaying specific information.

 

Some of the listed items in the text field on page 1 does not have information to display on the table.

 

My goal is to write a simple php code to say "There is no information currently available for this item" on page 2 when you select an item with no information to display on the table on page 2.

 

I want only the text to display and not the table.

 

Where would I have to place the code for that to happen and what type of code do you suggest I use?

 

 

Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/281250-php-to-display-message/
Share on other sites

where is the code that you are using now? any way you can write a php code on top of the page before any html that will check for whatever house keeping and if requirements are not met then set the messege in a session and  redirect either to the referer page or any page of your choice.

lets say!!!
 

<?php  if (1 != 2){

session_start();

 $_SESSION['message'] = "Requirements not mate";

header("Location: {$_SERVER['HTTP_REFERER']}");

exit;

}

?>

 

 

then on the other page make a condition statment that checks if $_SESSION['massege'] is set and if yes display it and destroy it.

 

if(isset($_SESSION['message'])){

echo $_SESSION['message'];

unset($_SESSION['message']);

}

 

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.