PHP variable problem with pelicas

Asked

Viewed 64 times

2

I’m bringing this mysql database variable for a text input, but the result I’m not showing because of the pelicas.

$cota = '946.9"1968/1975" AMA Ant';

echo '<input type="text"  value="'.$cota.'" />';

result: 946.9

2 answers

3


Do it:

<?php

$cota = '946.9"1968/1975" AMA Ant';

echo "<input type='text'  value='" . $cota . "'/>";

2

Basically use htmlentities:

<?php

$cota = '946.9"1968/1975" AMA Ant';

echo '<input type="text"  value="'.htmlentities($cota, ENT_QUOTES).'" />';

Reference: htmlentities

  • 1

    This solution also works, thank you.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.