[PHP] radio buttons
Used HTML code: PHP code: $msgtxt .= "\r\nEmpleados: $empleados"; Whatever radio button is selected, the $msgtxt becomes: "Empleados 0" As far as I know the variable $empleados should have the choice that was made in the form. Why did it return "0"? What did I do wrong? Note that all other form entries work fine, only radio buttons seem to be problematic. Please CC to my email too. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] radio buttons
Just a hunch... but try value="1–24" and see how that works, so basically substitute "-" for "–" I can't see the rest of your code and what else you might be appending to $msgtxt, so it could be something else... Rick > Used HTML code: > > > > > > > PHP code: > $msgtxt .= "\r\nEmpleados: $empleados"; > > Whatever radio button is selected, the $msgtxt becomes: "Empleados 0" > > As far as I know the variable $empleados should have the choice that was > made in the form. Why did it return "0"? What did I do wrong? Note that all > other form entries work fine, only radio buttons seem to be problematic. > > Please CC to my email too. > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] radio buttons
> Just a hunch... but try value="1–24" and see how that works, so > basically substitute "-" for "–" > > I can't see the rest of your code and what else you might be appending to > $msgtxt, so it could be something else... Yes it was something else. I did a wrong comparison with the variable: $empleados="" in stead of $empleados=="". So it was set to be an empty string. Still doesn't explain the 0 though, but anyhow, it works now -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] radio buttons
Actually it does explain it, you set the variable to false, which of course is 0, so that's why you had a 0 :) Also a good way of seeing if the variable is set, no equaling 0, "", " ", false, etc is by using the empty function if (empty($empleados)) Glad you figured it out though! Cheers Rick >> Just a hunch... but try value="1–24" and see how that works, so >> basically substitute "-" for "–" >> >> I can't see the rest of your code and what else you might be appending to >> $msgtxt, so it could be something else... > > Yes it was something else. I did a wrong comparison with the variable: > > $empleados="" in stead of $empleados=="". So it was set to be an empty > string. Still doesn't explain the 0 though, but anyhow, it works now > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]