Refreshing SESSION variable with an HTML form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ArizonaJohn
    New Member
    • May 2009
    • 21

    Refreshing SESSION variable with an HTML form

    Hello,

    I have an HTML form at the top of a page called tsearch18.php. This page uses "find" as a session variable. I would like to change the value of the "find" session variable each time a new value is entered into the HTML form. How do I do this?

    Thanks in advance,

    John

    Code:
    <?php
    session_start();
    
    $find = strip_tags($find);
    $find = trim ($find);
    $find = strtolower($find);
    $_SESSION['find'] = $find;
    ?>
    
    
    <div class="searchbox">
      <form action="tsearch18.php" method="post">
      <label>Enter Topic:
      <input type="text" name="find" size="55"/>
      <input type="hidden" name="searching" value="yes" />
      <input type="submit" name="search" value="Search" />
      </label>
      </form>
      </div>
  • prabirchoudhury
    New Member
    • May 2009
    • 162

    #2
    Refreshing SESSION variable with an HTML form

    hey ..

    1. you are posting 'find' with form submit
    Code:
     
    "<input type="text" name="find" size="55"/>

    2. when you submit the form and then you could re-assign the session top of the tsearch18.php page

    Code:
    if (isset($_POST['find'])){
    
    $_SESSION['find'] = $_POST['find'];
    }

    that would reassign the session whenever the post vars get submit

    Comment

    Working...