I'm working on a site where people can order food online. I have a menu page with a text input field next to each item where people can type in how much they want of that item. Once they hit submit, the whole form is submitted to a script page which will process it.
The problem I'm having is that underscores ("_") keep being substituted into all my spaces. For example, the name of one of the fields on this form is:
"House Pizza (small)|5.50"
When the form is submitted, I am running this script:
foreach ($_POST as $key => $value) {
if ($value > 0) {
// break up the key string into price and item
list ($item, $price, $type) = split ('[|]', $key);
}
}
which returns this:
Array ( [House_Pizza_(small)|5_50] => 0)
It seems to automatically be putting in underscores in places of spaces and decimals. Any ideas why it is doing this?