how can i pass value of textbox into code iginator controller after submit. i get Disallowed Key Characters message. i have array of controls.
or if you could provide some tips on how to get the posted values in controllers .
in view

<form method="post">
<input type="text" name="Insert['name']"/>
<input type="text" name="Insert['fname']"/>
<input type="submit" value="Insert"/>
</form>

in controller

<?php
if (!defined('BASEPATH'))
	exit('No direct script access allowed');
class Helloworld extends CI_Controller {
	public function index() {
		$data['InsertedRecord']=$this->input->post('Insert['name']');
		
$this -> load -> view('helloworld', $data);
	}
}

regards,

Recommended Answers

All 3 Replies

Member Avatar for diafol
('Insert['name']')

problem with quote:
try

("Insert['name']")
('Insert['name']')

problem with quote:
try

("Insert['name']")

thanks for reply i passed that this way the quote is creating problem.

<input type="text" name="name[]"/>

then in controller i loop through array.

for($i=0;$i<count($_POST['name']);$i++) echo $_POST['name'][$i];
Member Avatar for diafol

The point I was making is that having consecutive quotes (') in this case, leads to

post('Insert['name']');

changing to

post([B]'Insert['[/B](AND)name(AND)[B]']'[/B]);

The parameter passed will either be 'Insert or you'll hit an error.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.