PRodgers4284 Posted February 21, 2008 Share Posted February 21, 2008 Im having problems with a field in a form i am using, i need the salary field in the form to hold a "£" in the input field by default, can anyone help? My code for the salary field is: <fieldset> <label for="salary">Salary:</label> <input name="salary" type="text" id="salary" value="<?php echo $_POST['salary']; ?>"/> <span class="redboldtxt"><?php echo "$salary_message";?></span></fieldset> Quote Link to comment https://forums.phpfreaks.com/topic/92304-form-input-help-salary-field/ Share on other sites More sharing options...
schilly Posted February 21, 2008 Share Posted February 21, 2008 Just add £ to where ever you need. If you put it in the field you will need to strip it out again if you update the db. Quote Link to comment https://forums.phpfreaks.com/topic/92304-form-input-help-salary-field/#findComment-472932 Share on other sites More sharing options...
PRodgers4284 Posted February 21, 2008 Author Share Posted February 21, 2008 Just add £ to where ever you need. If you put it in the field you will need to strip it out again if you update the db. Is there an easy way of striping it out? Quote Link to comment https://forums.phpfreaks.com/topic/92304-form-input-help-salary-field/#findComment-472944 Share on other sites More sharing options...
Psycho Posted February 21, 2008 Share Posted February 21, 2008 From my experience adding that tot he actual field is not worth the time, effort or greater propensity of error. Just put the symbol right in front of the field Example: __________ Salary £ [__________] Quote Link to comment https://forums.phpfreaks.com/topic/92304-form-input-help-salary-field/#findComment-472950 Share on other sites More sharing options...
schilly Posted February 21, 2008 Share Posted February 21, 2008 From my experience adding that tot he actual field is not worth the time, effort or greater propensity of error. Just put the symbol right in front of the field Example: __________ Salary £ [__________] thats what I normally do. Quote Link to comment https://forums.phpfreaks.com/topic/92304-form-input-help-salary-field/#findComment-472960 Share on other sites More sharing options...
Barand Posted February 21, 2008 Share Posted February 21, 2008 Never store formatted numeric values. Always format on output. Quote Link to comment https://forums.phpfreaks.com/topic/92304-form-input-help-salary-field/#findComment-472996 Share on other sites More sharing options...
craygo Posted February 21, 2008 Share Posted February 21, 2008 I agree. try summing up those number when there is something other than the number in the field. Can be a major nightmare. If you are going to have several different dollar amounts add another field with the currency type. then the scripts could generate the currency symbol on the fly. Ray Quote Link to comment https://forums.phpfreaks.com/topic/92304-form-input-help-salary-field/#findComment-473000 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.