tags:

views:

38

answers:

2

Whenever the texts value has double-quotes, everything behind and including the double-quotes dissappear.

Ex: Nice bmw m3 with 19" wheels BECOMES Nice bmw m3 with 19 the part after the double-quotes is skipped.

Is there anyway around this?

About the code below: This is for a form on a php page, so when the form is submitted to itself the value of the input remains unchanged, so the user doesn't have to fill in everything again whenever form is submitted to self.

<input style="width:300px;" type="text" name="annonsera_headline" id="annonsera_headline" value="<?php echo @$_POST['annonsera_headline'];?>">

Thanks

+2  A: 

You forgot to sanitize the value with htmlentities().

Ignacio Vazquez-Abrams
check the comment above, do you know the answer to that? I am using utf-8 on every document so far. Thanks
Camran
Try passing false as `double_encode`.
Ignacio Vazquez-Abrams
Never mind, used "htmlentitie($var, 'UTF-8')
Camran
+3  A: 

Because " ends the value of the html attribute.

Use htmlentities or htmlspecialchars

value="<?php echo htmlentities(@$_POST['annonsera_headline']);?>">

It is not advisable to write values from $_POST or $_GET without using at least one of the above functions as otherwise it allows people to construct a URL that alters the HTML on your page.

Yacoby