php - POST values being lost from included page preventing session data from being created [SOLVED] -


I have a head page that includes the header page so that we can edit headers in a quick process in all pages. The issue I am running is that there is a search option on this header, and I want to save the search term in the session variable. It works fine if the header is on the page and is not included on any page, but as soon as I put the header in my file, the search function stops working as intended.

This includes only the code:

   

Here is the header.php code:

  & lt ;? Php if (! Isset ($ _ session)) {session_start (); } If $ {_SESSION ['query'] = $ _POST ['query' ((isset ($ _ POST ["search"])) & amp; amp; ($ _POST ["search"] == "1" ']; }? & Gt; & Lt; Html & gt; & Lt; Body & gt; & Lt; Form action = "& lt ;? php echo $ redirect action ;? & gt;" Method = "post" & gt; & Lt; Placeholder = "search" size = "20" value = "& lt ;? php $ _SESSION ['query'];? & Gt; / & gt; input type =" text "name =" query "id =" query " Input type = "hidden" name = "search" id = "search" value = "1" />  

What happens when I submit a search, page re Loads, but the search data was not saved I may miss something important, but I have no one about it Is anyone getting it to think that what is the problem or is it not possible?

Do not use include in full path . You will need to use the relative path to work on it.

< Pre> & lt ;? php include '/tclusa/header.php';? & Gt;

Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -