php - my $_SESSION["message"] echoing everywhere even there is if -


I have a problem. I want to resume my message ("created subject", "subject failing creation" is not created or not) The problem is that the message is on every page, even if $ _ session ["message"] setting if is under the condition I really do not know where the problem is < / P>

This is on my proceedings page ...

  if (isset ($ _ POST ["submit"])) {$ menu_name = mysql_prep ($ _ POST [" Menu_name "]); $ Position = (int) $ _POST ["status"]; $ Visible = (int) $ _POST ["visible"]; $ Query = "Include in topics ("; $ query. "=" Menu_name, position, visible "; $ query. =") VALUES ('{$ menu_name}', '{$ position}', '{$ visual } '; $ Result = mysqli_query ($ connection, $ query); if ($ result) {// success // $ _SESSION ["message"] = "created topic"; redirect_to ("manage_content.php"); } And {$ _SESSION ["message"] = "theme creation failed" redirect_to ("create_new_content.php");}} Else {redirect_to ("create_new_content.php");}   

My message function is:

  session_start (); function message () {if (isset ($ _ session ["message"])) {$ output = $ _SESSION ["message"] ; Return $ output;}}   

and after all my manage_content.php and create_new_content.php

  & lt; php echo message ();? & gt;   

You should clear the session when it is not needed.

Eg

Unset ($ _ session ['message']);

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -