PHP | Only first word showing in textbox from assigned sentence

Author - Webner
3.03.2017
|
0 Comments
|

Problem: After the first space in the string no data appears in the input field.

There is an issue when a string contains words with spaces and we want to display the whole string in an input field but after the first space, no data is displayed in the input field.

Solution: This problem occurs when we don’t display the string in double quotes.

For example: The string is:

$var= ”this is the first string”;
<input type=”text” id=”input” value=’.$var.’>

In this case, input field shows only “this” and rest of the string is not displayed.

So to overcome this problem we have to use the variable in double quotes and the whole string is displayed as it is.

For example:

$var=”this is the first string”;
<input type=”text” id=”input” value=” ’.$var.’ ”>

This is the right way.

Webner Solutions is a Software Development company focused on developing Insurance Agency Management Systems, Learning Management Systems and Salesforce apps. Contact us at dev@webners.com for your Insurance, eLearning and Salesforce applications.

Leave a Reply

Your email address will not be published. Required fields are marked *