Hi guys,

I have a page that echos fields from a database based on various text and combo box selections. I am trying to get it so that when the page is refreshed, the echoed vales are still displayed, even if the form fields are reset.

Im under the impression that i need to use cookies to acheive this however all the code I find via google only lets me display cookie values.

The code i use to display the database values is as follows:

				mysql_connect ("localhost", "pegasus","123456")  or die (mysql_error());
				mysql_select_db ("partslist");

				if ($term == "") {
				echo "";
				else {
				$sql = mysql_query("select * from $table where part like '$term'");
				while ($row = mysql_fetch_array($sql)){
			<div id="display-part"><?php echo $row['part'] .'&nbsp;'.$table; ?></div>
			<div id="display-partno"><?php echo $row['partno']; ?></div>
			<div id="display-alternative"><?php echo $row['alternative']; ?></div>

All help is greatly appreciated.

7 Years
Discussion Span
Last Post by gunnarflax

You could display it via sessions instead of cookies which I find much more convenient. Or you could integrate the whole thing with AJAX if you know your way around JavaScript.


Hi guys thanks for the replys.

gunnarflax: I have spent all morning trying to keep the values with sessions however I have had no luck.

rajarajan07: do you know any example code that could help me with this. I have tried to search google however I cant seem to find anything.


This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.