Streaming live at 10am (PST)

Submitting to PHP Form with no Checkbox value selected

Hi Dave,

I am using this topic - hope you don’t mind - to ask a question about using an external php submit action. I am using a checkbox and I noticed in the HTML the value parameter is only appearing in case the checkbox is checked. Actually quit simple because using:

$checkbox_name = $_POST['checkbox_name '];

You can use:

 $message .= "<p>label of checkbox: {$checkbox_name}</p>";

To stamp this in the mail. So far, so good. But the value in the is set to “on” and because I would like to use another language I am searching where I can translate the returned value “on” to “aan” (Dutch :slight_smile: )

I tried to use an shorted if statement:

$checkbox_name            = ( $_POST['checkbox_name '] == 'true' ) ? 'ja' : 'nee';

But that’s not working because (my assumption) there is no value whatsoever in case the checkbox is not checked.

Greeting & thanks in advance