943,771 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 1004
  • PHP RSS
Dec 1st, 2008
0

Initial Values

Expand Post »
Hi all, I put some initial values in a form field to help the user, i use php to extract the form data and send it via email. How do i get the initial value in the text field to stop appearing in the email. example, I have a name tag Town and the initial value I have shown that I want in that form field is Town. You can delete the initial value and then type the Town name, but i don't want users to have to do this.
I get Town name tag supplied but I also get
"Town: TownInverness" supplied by email, how do i stop the initial value been collected?
does this make sense?
thanks
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
stealthmode is offline Offline
15 posts
since Apr 2007
Dec 1st, 2008
0

Re: Initial Values

Okay, maybe I'm going about this wrong, If I just have the user filling in the form by telling them to delete the initial value before they type would this be a better way of doing this? That way I collect only the new value or text they put in the box with my php script. If they have javascript turned off, this I understand will also affect the browser by not deleting the value when they click in the box.
Is this the better thing to do?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
stealthmode is offline Offline
15 posts
since Apr 2007
Dec 2nd, 2008
0

Re: Initial Values

Hi..
According to what you have written in your post, i'll suggest you to use Javascript for this purpose..
When someone clicks on the text box, the initial value in it gets empty (town in this case), and then the new value entered by the user will appear in the email.. See the code attached

Hope this helps..

PHP Syntax (Toggle Plain Text)
  1. <script language="javascript" type="text/javascript">
  2. function when_obj_blur(frmObject,frmValue)
  3. {
  4. if(frmObject.value=="")
  5. frmObject.value=frmValue;
  6. }
  7. </script>
  8.  
  9. <input type="text" name="Town" value="Town" onfocus="javascript:this.value='';" onblur="javascript:when_obj_blur(this,'Town')">
Reputation Points: 11
Solved Threads: 12
Junior Poster in Training
sikka_varun is offline Offline
94 posts
since Dec 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: PHP and MYSQL Connections
Next Thread in PHP Forum Timeline: PHP+Ajax Help





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC