I have a script I’ve been using to take values from checkboxes on a form and create a string to be saved as a field in a MySQL database. The only problem is it stops using values if there is a break in the field order. For instance, if you post something like:
[CODE]priceOption8=275&priceOption9=24&priceOption10=798
It works fine and creates the string “275 24 798”. BUT, if you post something like:
[CODE]priceOption8=298&priceOption9=58&priceOption12=334
It only creates the string “298 58”.
Does anyone know how to revise this script to work when every option isn’t passing a value? Here is the current script:
[code=php]// Create one options string from multiple fields
$count = 1;
$priceOptions = ”;
$v_name = “priceOption” . $count;
while (${$v_name} <> ”) {
$priceOptions = $priceOptions . ” ” . ${$v_name};
$count ++;
$v_name = “priceOption” . $count;
}
$priceOptions = trim($priceOptions);
Any help would be greatly appreciated. Thank you!