title: PHP variable not recognized in jquery
body: <p>In my javascript I am trying to pass a php variable through the html name tag. The html is appended to my selected options.</p>
  
  <pre><code>$("#a"+$selected.val()).append('&lt;input type="hidden" name="&lt;?php echo $event_id; ?&gt;" value="'+$selected.text()+'"&gt;');
  </code></pre>
  
  <p>Here is the entire js function to see what is going on <a href="http://laravel.io/bin/Edz25" rel="nofollow">http://laravel.io/bin/Edz25</a></p>
  
  <p>Now, I know for a fact and have tested in my view that $event_id is returning an array by doing the following in my controller and also echoing the variable in the view.</p>
  
  <pre><code>print_r($event_id);
  die();
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>$data['event_id'] = $this-&gt;model_location-&gt;get_event_id();
  </code></pre>
  
  <p>Model:</p>
  
  <pre><code>public function get_event_id()
  {
  
      $this-&gt;db-&gt;select('id');
      $query = $this-&gt;db-&gt;get('table_eventcards');
  
      return $query-&gt;result_array();
  
  
  }
  </code></pre>
  
  <p>Now I am not sure why the variable in my javascript is not outputting anything.</p>
  
  <p>Here is the output when I inspect the element.</p>
  
  <pre><code>&lt;li data-value="28" id="a28"&gt;Event title&lt;input type="hidden" name="&lt;?php echo $event_id; ?&gt;" value="Event title"&gt;&lt;/li&gt;
  </code></pre>
  
  <p>If this helps this is my console log <a href="http://postimg.org/image/owtz3v8h7/" rel="nofollow">http://postimg.org/image/owtz3v8h7/</a></p>
  
  <p>I really need to get this solved and appreciate all help.</p>