Skip to content
Advertisement

getting value of with $_POST gives text

So, I’m retrieving these options from a database

select and options

and I need to retrieve the value but I’m getting the text in between the tags

<option></option>

by doing this

$inst = $_POST['inst'];

therefore if I print $inst I get the “IUTIRLA” for the first option but I need the 41

I don’t know what I’m doing wrong… this is how I’m printing the html through php

echo "<option value=".$cod_institucion.">".$nombre_institucion."</option>";

Advertisement

Answer

here you need to correct php code, as it is not parsing the values properly. Put values under quotes.

echo "<option value='".$cod_institucion."'>".$nombre_institucion."</option>";
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement