Use special characters in option

0

I do not know if it's possible but I need to use special characters in a <option> that has accents. The option value is collected in a variable called $genero . The example I am trying is the following:

<option name="Acci&oacute;n" value="Acci&oacute;n" <?php if ($genero == 'Acci&oacute;n') {echo 'selected';} ?>>Acción</option>
$genero = isset($_GET['Genero']) ? $_GET['Genero'] : 'todos';

However, I do not know if due to PHP or HTML, instead of receiving the value of Acci&oacute;n I receive the Acción , with which the search in the database is null.

    
asked by JetLagFox 25.05.2017 в 15:55
source

2 answers

6

The problem is the browser is decoding it, but you could use the function htmlentities()

A simple example:

<?php
    $var = "Acci&oacute;n";
    $x = htmlentities($var);
    echo $x;
?>

The result you will give us is the following:

Acci&oacute;n

More info: link

    
answered by 25.05.2017 / 17:04
source
-3

In PHP, place the following header:

<?
header("Content-Type: text/html; charset=iso-8859-1");  
?>
    
answered by 25.05.2017 в 18:42