Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to get the dropdown selected value and send it to controller in codeigniter
    primarykey
    data
    text
    <p>am having the following code</p> <p>view</p> <pre><code>&lt;script&gt; $(document).ready(function() { $("#Login").click(function() { $("#message").html(""); var action = $("#loginform").attr('action'); var login_data = { username: $("#txt_email").val(), password: $("#txt_password").val(), language: $("#language").val(), is_ajax: 1 }; $.ajax( { type: "POST", url: '&lt;?php echo base_url();?&gt;survey/login', data: login_data, success: function(response) { if(response == 'success') { $("#message").html("&lt;span class='success'&gt;You have logged in successfully!&lt;/span&gt;&lt;p&gt;Redirecting...&lt;/p&gt;"); setTimeout(function() { window.location.href = '&lt;?php echo base_url();?&gt;survey/communication_letter'; }, 2000); } else { $("#message").html("&lt;span class='error'&gt;OOPS! Authentication failed&lt;/span&gt;"); } } }); return false; }); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id= "header"&gt; &lt;br/&gt; &lt;p style="text-align:center; color:#8D0F1D;font-size:28px" &gt;Work Environment Survey&lt;/p&gt; &lt;/div&gt; &lt;div id= "bar" style="z-index:1"&gt; &lt;div id="logo" style="z-index:2"&gt; &lt;/div&gt; &lt;/div&gt; &lt;br/&gt; &lt;br/&gt; &lt;div id="homemain"&gt; &lt;!--div id="content-login"--&gt; &lt;br/&gt;&lt;br/&gt;&lt;br/&gt; &lt;form action="#" id="loginform" method="post"&gt; &lt;table border="0" align="center" cellpadding="5" cellspacing="10" &gt; &lt;tr&gt; &lt;td&gt;Email Id &lt;/td&gt; &lt;td&gt;&lt;input type="text" id="txt_email" name="username" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Password &lt;/td&gt; &lt;td&gt;&lt;input type="password" id="txt_password" name="password" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Select Language&lt;/td&gt; &lt;td&gt;&lt;select style="width:215px" name="language" id = "language" &gt;&lt;option value="simplified"&gt;English with Simplified Chinese&lt;/option&gt; &lt;option value="traditional"&gt;English with Traditional Chinese&lt;/option&gt; &lt;/select&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;input type="image" id="Login" style="position:relative;left:120px" src="&lt;?php echo base_url();?&gt;images/login.png"/&gt; &lt;/form&gt; </code></pre> <p>and the controller is as follows </p> <pre><code>public function login() { if(isset($_REQUEST['is_ajax']) &amp;&amp; $_REQUEST['is_ajax']) { $username = $_REQUEST['username']; $password = $_REQUEST['password']; echo $verify = $this-&gt;user_model-&gt;user_login($username, $password); exit; } $this-&gt;load-&gt;view('login'); } </code></pre> <p>here how can i get the dropdown selected value depending on the language selected i need to open the next page. please someone help me please, thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload