dev1902 Posted August 16, 2013 Share Posted August 16, 2013 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 Quote Link to comment https://forums.phpfreaks.com/topic/281250-php-to-display-message/ Share on other sites More sharing options...
hakimserwa Posted August 16, 2013 Share Posted August 16, 2013 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']); } Quote Link to comment https://forums.phpfreaks.com/topic/281250-php-to-display-message/#findComment-1445429 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.