Jump to content

worleyjbird

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

worleyjbird's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi - I have text that is saved to a session variable (sample_text). I need to save the text so that when users click the 'next' or 'previous' pages, the text can still be called and used. As it stands I can get text to be retained only on the page the user is currently viewing. I was thinking that I could append the 'sample_text=foo' to the query string. So when the user clicks 'next' or 'previous', the sample_text follows. Hopefully that all made sense. Any thoughts or ideas would be appreciated.
  2. Thanks for the response. The first line is what I added, the rest of the code checks to see if the user inputted any text. I'm not showing the echo statement which is later in the script but I'm assuming that isn't needed here because its printing the session, just not the 'sample_text'. $_SESSION['sample_text'] = htmlspecialchars($_POST['sample_text']); if(isset($_SESSION['sample_text'])) { $render_text_value = htmlspecialchars($_SESSION['sample_text'], ENT_COMPAT, 'UTF-8'); } elseif (isset($_POST['sample_text'])) { $render_text_value = htmlspecialchars($_POST['sample_text'], ENT_COMPAT, 'UTF-8'); } elseif (isset($_GET['sample_text'])) { $render_text_value = htmlspecialchars($_GET['sample_text'], ENT_COMPAT, 'UTF-8'); } else { $render_text_value = DEFAULT_RENDER_TEXT; } Hope this helps.
  3. Hi All, I have a page that allows users to search for a product. When there are more than, say, 25 products I get the pagination at the bottom of the page. Here's the kicker, on the main search page, users can input text into a text area. The issue is that (a) Once I click next to go to page 2, the data gets wiped out. And (b) If I click back to page 1, the text is wiped out as well. I want the user to type something and when they navigate to different pages, the text will always be there, regardless of how many pages the search results display. I created a session but its not working. When I echo the session to check for the text it says: "["sample_text"]=> string(0) "" }" I know it might sound strange that people are inputting text on a search page. They are really unrelated but the text is displayed along with the search results and thus I need to maintain that text when going from page to page, etc. Any information would be greatly appreciated.
×
×
  • 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.