简体   繁体   中英

How to fix odd value returned from select list populated by database

Using PHP I'm populating a dropdown list with values taken from a MySQL database. The list displays fine, my problem comes when I try to retrieve the selected value. I'm defining a variable and passing it the dropdownlist name for the POST array:

$variable = $_POST['dropdownlist'];

but the contents of $variable are \\{value}"

Why is it putting in the \\{ and }", and how do I get rid of them to get a value I can actually use?

If you are getting curly brackets as part of the value then the chances are they are their in your HTML code. Your code is likely something like echo '{$value}'; rather than echo "{$value}"; or something similar.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM