I have a problem in text box always focusing second word instead of first word. If I set Maxlenth=1 means it doesn't allow me to type. After pressing backspace only I can type. Help me out from this.
Here is my Code:
<input type="text" name="exMark[]" id='exMark' value=" " style="width:30px; height:20px; text-transform:uppercase;" maxlength='1'>
remove space from attribut value=" ". Change it to value="" or dont write it at all.
<input type="text" name="exMark[]" id='exMark' value="" style="width:30px; height:20px; text-transform:uppercase;" maxlength='1'>
Remove that extra space in value=" "
Related
I am using a php variable in html. $userProfile['institute'] is displaying correct value whenever $userProfile['institute'] is non-empty. When $userProfile['institute'] is empty , it display '/'. What may be the issue here ?
Institute: <input type="text" name="institute" value=<?php echo $userProfile['institute']?> /><br />
You are missing a set of quotes for your value attribute
value="<?php echo $userProfile['institute']?>"
You should add double quotes around it like this (like you have wrapped value of type and institute attributes )
Institute: <input type="text" name="institute" value=" <?php echo $userProfile['institute']?>" /><br />
I have form with input text and this form action direct to the same page,
now i insert string into input text like "air garden" then submit but after that string in input text become one word that mean it show only "air" not "air garden".
<input type="text" id="sfo_keywords" <?php if($sfo_array['sfo_keywords']) echo "value=".$sfo_array['sfo_keywords'];?> />
This is because you're appending directly to the value= without extra quotes, then in your html code you have something like
<input type="text" value=air garden />
instead of:
<input type="text" value="air garden" />
You can to that to fix it :
<input type="text" id="sfo_keywords" <?php if($sfo_array['sfo_keywords']) echo "value=\"".$sfo_array['sfo_keywords']."\"";?> />
You've missed the quotes:
<input type="text" id="sfo_keywords"
<?php if($sfo_array['sfo_keywords']) {
echo "value='".$sfo_array['sfo_keywords'];."'";
}
?>
/>
If you don't wrap the values of the attributes into quotes only the first occurrence will be rendered, and next will be considered attributes.
Example:
<input class="one two">
Or
<input class=one two> <!-- here you are the "two" attribute-->
I am making a form that will save to an xml file using php. I have gotten everything to work great, but I want to automatically add a $ to the input field so the user does not have to. How can I start out with a $ as the first character? (Only dealing with whole dollars so I don't need to worry about decimals). This is the simple text input I have made.
<label>Price:</label><br />
<input type="text" name="txtPrice" />
Use ::before in CSS
label::before {
content:"$";
color: blue;
}
<label><input type="text" name="txtPrice" id='input' /></labl>.
Working Demo
Try this:
<label>Price:</label><br />
<input type="text" name="txtPrice" value="$" />
Or this:
<label>Price:</label><br />
$<input type="text" name="txtPrice" value="$" />
I was just having fun with this one, but it puts the $ in the box.
http://jsfiddle.net/NGH7d/3/
Not sure if this will work in IE6-8, also you probably need to adjust the numbers around.
<label class="money">$</label><input type="text" id="txtprice" name="txtPrice" id='input' />
label.money{
color: blue;
float:left;
position:relative;
left:12px;
top:3px;
}
#txtprice {
padding-left:12px;
}
I have anchor tag and input tag
Go to Example.com
and
<a href="example.com">Go to Example.com</a>
Now I need to display above text in input box
<input type="text" value="Go to Example.com">
But it's not working, How can I do this?
Change quotes to html entities:
"
<input type="text" value="<a href="example.com">Go to Example.com</a>">
<input type="text" value="<a href="example.com">Go to Example.com</a>">
I'm using PHP to retrieve the data from a database.
Every time I retrieve it from database it doesn't show the whole letters. It's being removed off after space???
I want like the first text box, show all the letters
both code doesn't work
<input type="text" class="textinput" value=' . $r['newsletter_title'] . '>
<input type="text" class="textinput" value=' . htmlspecialchars($r['newsletter_title']) . '>
I checked the database it's showing the whole letters "80% sale On Day"
Does anyone knows what causes this? Any solution please!!!
You need to quote the value (and use htmlspecialchars):
<input
type="text"
class="textinput"
name="newsletter_title"
id="newsletter_title"
value="' . htmlspecialchars($r['newsletter_title']) . '"
/>
Which generates:
<input
type="text"
class="textinput"
name="newsletter_title"
id="newsletter_title"
value="80% sale On Day"
/>
Otherwise you're generating invalid html/xml (which is why it isn't working)...
Type escaping the content with htmlspecialchars() - http://www.php.net/manual/en/function.htmlspecialchars.php
The value of the value-attribute is not enclosed in quotes. Enclose the value of the value attribute in quotes. Use your browser to look at the HTML that you generate. Don't just look at how your browser renders that HTML.
<input type="text" class="textinput" name="newsletter_title" id="newsletter_title" style="width:500px;" value="' . htmlspecialchars($r['newsletter_title']) . '">
Problem Solved. Thanks guys!