title: Sending a hidden input from a form to a controller in Laravel
body: <p>I have a</p>
  <h1>Create Form</h1>
  <pre><code>{!! Form::open(array('url' =&gt; '/cpe/store', 'class' =&gt; 'form-horizontal', 'role' =&gt;'form')) !!}
  
                &lt;h3 class=&quot;nomargin&quot;&gt;Create CPE &lt;/h3&gt;
  
                &lt;div class=&quot;mb10&quot;&gt;
                    &lt;label class=&quot;control-label&quot;&gt;Account ID &lt;/label&gt;
                    &lt;input type=&quot;text&quot; class=&quot;form-control&quot; name=&quot;account_id&quot; value=&quot;{{$account-&gt;account_id}}&quot;&gt;
                &lt;/div&gt;
  
            
                &lt;div class=&quot;mb10&quot;&gt;
                    &lt;label class=&quot;control-label&quot;&gt;Max Up&lt;/label&gt;
                    &lt;input type=&quot;text&quot; class=&quot;form-control&quot; name=&quot;max_up&quot; value=&quot;30000&quot;&gt;
                &lt;/div&gt;
  
                &lt;div class=&quot;mb10&quot;&gt;
                    &lt;label class=&quot;control-label&quot;&gt;Max Down&lt;/label&gt;
                    &lt;input type=&quot;text&quot; class=&quot;form-control&quot; name=&quot;max_down&quot; value=&quot;50000&quot; &gt;
                &lt;/div&gt;
  
  
  
                &lt;a href=&quot;/account/&quot; class=&quot;btn btn-danger &quot;&gt;Go back to account &lt;/a&gt;
  
                {!! Form::hidden('$id', $account-&gt;account_id )!!}
  
                &lt;button type=&quot;submit&quot; class=&quot;btn btn-success &quot;&gt;Create&lt;/button&gt;
  
  
              {!! Form::close();!!}
  </code></pre>
  <hr />
  <h1>Store Function</h1>
  <pre><code>public function store() {
  
          $inputs = Input::all();
          unset($inputs['_token']);
        
  
          $cpe_mac = $inputs['mac1'].$inputs['mac2'].$inputs['mac3'].$inputs['mac4'].$inputs['mac5'].$inputs['mac6'];
  
          $cpe = [];
  
          $cpe['cpe_mac'] = $cpe_mac;
          $cpe['bandwidth_max_up'] = (int)$inputs['max_up'];
          $cpe['bandwidth_max_down'] = (int)$inputs['max_down'];
  
          $json = json_encode($cpe);
  
          try {
  
              $url = 'http://172.16.139.129:1234/vse/vcpe';
              $ch = curl_init($url);
  
              if (FALSE === $ch)
                  throw new Exception('failed to initialize');
  
              curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
              curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
              curl_setopt($ch, CURLOPT_POST, 1);
              curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
              curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 1);
              curl_setopt($ch, CURLOPT_TIMEOUT, 1);
              $result = curl_exec($ch);
              curl_close($ch);
  
              if (FALSE === $result)
                  throw new Exception(curl_error($ch), curl_errno($ch));
  
              // ...process $result now
          } catch(Exception $e) {
  
              trigger_error(sprintf(
                  'Curl failed with error #%d: %s',
                  $e-&gt;getCode(), $e-&gt;getMessage()),
                  E_USER_ERROR);
  
          }
  
          $result_json =  json_decode($result, true);
  
  
          dd($id); // Undefined variable: id
  
  
          if ( $result_json['status'] == '200') {
              return Redirect::to('/account/'.$id.'#hardware') -&gt;with('success','The CPE was created succesfully!');
          } else {
              return Redirect::to('/account/'.$id.'#hardware') -&gt;with('error', $result_json['message']);
          }
  
      }
  </code></pre>
  <hr />
  <p>I'm trying to pass <code> {!! Form::hidden('$id', $account-&gt;account_id )!!}</code> to my store controller so I can access it inside my <code>store()</code> function in my controller.</p>
  <p>But I keep getting <code>Undefined variable: id</code></p>
  <p>Can someone please show me the proper way of sending a hidden input from a form to a controller ?</p>