Jump to content

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']);

}

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.