OK I'm pretty sure this is an easy one. I've successfully made my list and checkbox fields sticky using selected=selected and checkbox=checkbox etc etc.

I now have a very simple text field.

What is going wrong is that the entire string within the value="" shows up as the initial value in the field- so that when you look at the form this is what you see in the field.

How do I make the field sticky without any initial value show up?

many thanks for the help.

<td align="left"><label for="prop_pricemin"></label>
                    <input name="prop_pricemin" type="text" id="prop_pricemin" value="<?php if(isset($_POST['prop_pricemin'])) echo $_POST['prop_pricmin'];?>" />
6 Years
Discussion Span
Last Post by Akash Saikia

First thing is that i did not understand your problem,what you want and what is it currently showing.

Second thing is that your code has spelling mistakes...

if(isset($_POST['prop_pricemin'])) echo $_POST['prop_pricmin'];?>" />

replace it with

if(isset($_POST['prop_pricemin'])) echo $_POST['prop_pricemin'];?>" />

Mistake is echo $_POSTe[/U]min'];?>"
That underlined letter was missing...
Waiting for your problem definition if any...


Hi Sorry

Thanks for pointing out the typo :-)

I think what I'm trying to say is that prior to putting in the code to make the textfield sticky - I have an initial value in there "min" as a way of telling users what to put in the field. Is it still possible to show an initial value in the field instead of it now just showing as blank?

Many thanks


I am still a bit confused,but check if it helps or not..

A change is made here

<td align="left"><label for="prop_pricemin"></label>
      <input name="prop_pricemin" type="text" id="prop_pricemin" value="<?php if(isset($_POST['prop_pricemin'])){echo $_POST['prop_pricmin'];}else{ echo 'Min';}?>" />

Edited by Akash Saikia: Typo



here is a url:


In the 2 price fields - I have the 2nd field with the word 'max'in it. The other field read 'min', but when I make the field sticky, it seems I can't then have a value showing?

If it can't be done then it is not a big deal, just one of those nice-to-have's thats bugging me :-)
Many thanks for the help though...


Ok,i have gone through the URL you posted.
So what you want is when user clicks on either of the textboxes,then the value max or min should not be visible,and when user loses the focus,'max' or 'min' should be shown there if a value is not inserted here.

If this is the problem then do this..

<td align="left"><label for="prop_pricemin"></label>
  <input name="prop_pricemin" type="text" id="prop_pricemin" 
onclick="if(this.value=='Min'){this.value='';}" onblur="if(this.value==''){this.value='Min';}"   value="<?php if(isset($_POST['prop_pricemin'])){echo $_POST['prop_pricmin'];}else{ echo 'Min';}?>" />

Hope this time it helps,if it does not then plese specify that what is the meaning of word STICKY in your context...:(


That is awesome! I love it.
Yes by sticky I just meant that whatever value the user put into the field remains, so that when they want to do a different search they dont'have to retype everything.

Thanks very much. That is way more than what I was hoping for :-)


Yeppi :D
And please do it for other fields as well,like your Username and Password...

And i want to Buy TajMahal,any reference please LOL :)

Mark it as solved if it helped,so it can help others...

This question has already been answered. 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.