niche Posted August 25, 2010 Share Posted August 25, 2010 Why does my input box retain data when I reload the page? Link to comment Share on other sites More sharing options...
thescientist Posted August 25, 2010 Share Posted August 25, 2010 is the page submitting to itself? could you show us whats going on? Link to comment Share on other sites More sharing options...
niche Posted August 25, 2010 Author Share Posted August 25, 2010 Here's the script for the search input: <div style="margin-left:60px;"> <div><form action="search2.php" method="post" > <input type="text" name="search" value="Keyword or Item #"/><br /> <select size="1" type="text" name="kind" > <option>Everything</option> <option>Business</option> <option>Category</option> </select><br /> <input type="submit" id="mysubmitbut" /> </form></div></div> Link to comment Share on other sites More sharing options...
thescientist Posted August 25, 2010 Share Posted August 25, 2010 so, is search2.php a different page then the one the form is on? If it's a different page, then I'm not sure what the problem is without seeing more. Link to comment Share on other sites More sharing options...
niche Posted August 25, 2010 Author Share Posted August 25, 2010 Here's search2.php: <?phpecho var_dump($_POST);$search = $_POST['search'];echo $search;?> It's just a placeholder right now.I expected my search script to display the value of the input box (Keyword or Item #) each time I pressed the page reload/refresh button on my browser. Except, what ever I typed in that box remains and I don't know why. Link to comment Share on other sites More sharing options...
music_lp90 Posted August 25, 2010 Share Posted August 25, 2010 After submitting the form, do you mean the data is still there after hitting back on the browser or are you going back and then hitting refresh and it still stays after hitting refresh? Link to comment Share on other sites More sharing options...
niche Posted August 25, 2010 Author Share Posted August 25, 2010 its still there after i hit back and then refresh/reload. Link to comment Share on other sites More sharing options...
Ingolme Posted August 25, 2010 Share Posted August 25, 2010 That's a browser feature. Some browsers do that in case a user accidentally clicked a link and wants to hit back, or if they accidentally reloaded the page. Link to comment Share on other sites More sharing options...
niche Posted August 26, 2010 Author Share Posted August 26, 2010 Thanks to thescientist, music_lp90, and Ingolme. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.