[eluser]kit005[/eluser]
I'm a newbie in codeigniter, my problem is the javascript it doesnt work in Ci though my css goes well in it.. I just cant find my mistake.. Hope somebody can help me.. I appreciate it so much..
My home page
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <base href="<?php echo base_url();?>" /> <title>My Page</title> <meta http-equiv="Content-Language" content="English" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
[removed][removed]
[removed][removed]
[removed][removed]
[removed][removed]
[removed][removed]
<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>css/stylered.css" media="screen" />
<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>button.css" media="screen" />
</head>
<body>
<div id="centered">
<div id="wrap">
<div id="header">
<img src="/demo/images/headerred.jpg" width="82%" heigth="20%" />
</div>
<div id="top"> </div>
<div id="content">
<div>
<div id="box">
<br /><br />
<br /><br />
<br /><br />
<table width="420">
<form method="GET" id="myform" name="myform">
<tr><?php echo form_open('educ/view2'); ?>
<td width="420" height="15" align="center">
<p>
<input type="text" id="contractno "name="contractno" maxlength="7" size="25" class="form" autofocus="autofocus"/>
</p>
</td>
</tr>
</table>
<br />
<div>
<table id="table">
<tr>
<td width="413" height="35" align="center">
<input name="submit" id="submit" type="image" src="<?php echo base_url();?>images/submit2red.png" width="30%" heigth="15%" value="submit" />
<?php echo form_close(); ?>
</td>
</tr>
</form>
</table>
</div>
</div>
</div>
<div>
</div>
</div>
<div id="bottom">
</div>
<div id="footer">
</div>
</div>
</body>
</html>
My root derictory
+system
+application
-views
-index
-view2
-display
-display2
-controller
+index
+js
-function
-jquery
-js_lib
-soon
+css
-style.css
-stylerd.css
My problem is, when the user inputs it doesnt fetch the data and direct to the other page, it remain just in that page..
My controller
Code:
<?php
class educ extends CI_Controller
{
public function __construct()
{
parent::__construct();
$this->load->helper(array('form', 'url'));
$this->load->library('javascript');
$this->load->model('educ_model');
}
public function index()
{
$data['library_src'] = $this->jquery->script();
$data['script_head'] = $this->jquery->_compile();
$this->load->view('educ/index');
/*if(count($queryr['details'])==0)
{
echo "[removed]alert('Enter Contract Number');[removed]";
}*/
}
public function view2()
{
session_start();
$_SESSION['contractno'] = $_REQUEST['contractno'];
$queryr['details'] = $this->educ_model->educplan($_SESSION['contractno']);
if(count($queryr['details'])>0)
{
$this->load->view('educ/view2', $queryr);
}
else {
echo "[removed]alert('No Record found');[removed]";
$this->load->view('educ/index');
}
}
public function display()
{
session_start();
$cno = $_SESSION['contractno'];
/*$_SESSION['sname'] = $_REQUEST['sname'];
$_SESSION['fname'] = $_REQUEST['fname'];
$_SESSION['mi'] = $_REQUEST['mi'];
$_SESSION['dob'] = $_REQUEST['dob'];
$_SESSION['contractdate'] = $_REQUEST['contractdate'];*/
$queryr['details'] = $this->educ_model->educplan($cno);
$this->load->view('educ/display', $queryr);
}
public function display2()
{
session_start();
$cno = $_SESSION['contractno'];
$_SESSION['neweadd'] = $_REQUEST['eadd'];
$_SESSION['newcpnum'] = $_REQUEST['cpnum'];
$_SESSION['newcpprefix'] = $_REQUEST['cpprefix'];
$queryr['details'] = $this->educ_model->educplan($cno);
$queryr['beneficiary'] = $this->educ_model->beneficiary($cno);
//print_r($queryr);
$this->load->view('educ/display2', $queryr, $_SESSION);
}
public function save()
{
session_start();
$cntno = $_SESSION['contractno'];
$educdata = array(
'cpprefix' => $_SESSION['newcpprefix'],
'cpnum' => $_SESSION['newcpnum'],
'eadd' => $_SESSION['neweadd']
);
//print_r($educdata);
$this->educ_model->savechanges($educdata,$cntno);
echo "[removed]alert('DATA UPDATED!!!');[removed]";
$this->load->view('educ/cert');
}
}
It works well in php but when i transfer it in CI i got a hard time.. :down: