Input is "Cutting" what comes after space with PHP [closed]

-3

I have a change register screen. The information that will be changed I bring to an input field, allowing the user to move if necessary.

However, a problem occurs if the word is separated by 'space', that is, if the user types "Olá mundo" , it only goes to the input field "Olá" .

HTML:

<a a class="arib">Origem: </a><input type="text" maxlength="40" placeholder="Origem" value=<?php echo $Origem; ?> name="origem" style="width:50px;"/>

PHP:

<?php
$Origem = "Olá Mundo";
?>
    
asked by anonymous 03.05.2018 / 21:49

2 answers

2

Your value=<?php echo $Origem; ?> must be value="<?php echo $Origem; ?>"

    
03.05.2018 / 21:57
1

Unlinked middle type Olá mundo into a field that will only accept numbers, but I'll post my answer

From what I saw in the code, who does not allow to enter more than 4 characters is that of maxlength="4"

  

The maxlength attribute specifies the maximum length of the value that can be entered

Then Hello + a space add a length = 4

<a a class="arib">Origem: </a><input type="text" maxlength="4" placeholder="Origem" value="" name="origem" style="width:220px;"/>

Secondly, I do not think that the problem is the lack of quotation marks in Eu havia digitado errado no exemplo acima, mas no meu código estava um 40, o que solucionou o problema foi a solução do amigo Wess acima, , since the value always has a value filled by php value . To verify, I put an example below that even without quotes works to the satisfaction.

<a a class="arib">Origem: </a><input type="text" maxlength="40" placeholder="Origem" value=12  name="origem" style="width:50px;"/>
    
03.05.2018 / 22:40