Papple Papple -4 years ago 58
PHP Question

Variable not sent to server with IE

I am using checkboxes on one page on my website and I'm trying to be able to see the checked one(s) with PHP.

Here's the code:

<input id=checkBoxChrome form="saveform" type="checkbox" name="checkbox[]" value="Chrome" checked >

And the associated PHP:

public function save(Request $request) {
if (count($request->checkbox) == 0) {
\Session::flash ( 'error', 'Choose one browser minimum' );
return Redirect::back();



\Session::flash ( 'success', 'Scenario saved.' );

return redirect ( '/testscenarios' );

On Firefox and Chrome this code returns a success but it returns an error on IE. After some investigation I found that $request->checkbox returns the checkboxes in Chrome and Firefox, but nothing with IE.

Any idea why?

The command
gives me the following result:

array:3 [▼
"_token" => "TfE0jjLcxsAc69kWjTPAVL9BfJBTBjPILJP2rDqm"
"scenario" => "6"
"scripts" => "[[{"id":18,"elementid":51,"token":"","deleted":false},{"id":16,"elementid":52,"token":"","deleted":false}]]"

Answer Source

Okay so I found where the problem was coming from! The attribute form="saveform" is not supported by IE (HTML5) and it is with the two other browsers.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download