Thursday, 15 May 2014

html - textbox in php value not outputting spaces -



html - textbox in php value not outputting spaces -

i have textbox in html need set value. upon loading modal (twitterbootstrap) textbox should have predefined value.

i'm having problem in outputting value php.

i have code:

<input class="form-control" type="text" name="inputbirthdate" id="datepicker" value=<?php echo $displaybdate; ?> required> </div> </div> <script src="pikaday.js"></script> <script> var picker = new pikaday( { field: document.getelementbyid('datepicker'), firstday: 1, mindate: new date('1980-01-01'), maxdate: new date('2020-12-31'), yearrange: [1980,2020] }); </script>

the variable $displaybdate has value string: "sat oct 18 2014". when seek checking value of variable using die($displaybdate), outputs "sat oct 18 2014".

now, i'm getting "sat". also, when seek value=<?php echo 'wat da f'; ?> textbox has "wat". means error starts first space. help

you need wrap php value within quotation marks.

change this...

<input class="form-control" type="text" name="inputbirthdate" id="datepicker" value=<?php echo $displaybdate; ?> required>

...into this...

<input class="form-control" type="text" name="inputbirthdate" id="datepicker" value="<?php echo $displaybdate; ?>" required>

php html twitter-bootstrap

No comments:

Post a Comment