Welcome Guest, Not a member yet? Register   Sign In
Error: "Disallowed Key Characters." ???
#1

[eluser]Michael Nielsen[/eluser]
Working with the controller below + a form. I just added come css to the form and now when I submit the form I get the follow error:

"Disallowed Key Characters."

I've played around with it but I can't figure it out!

Controller:
Code:
<?php
class Product extends Controller
{
    function Product()
    {
        parent::Controller();
    }
    function index()
    {
        echo anchor('store/product/create', 'Add Product');
    }
    function create()
    {
        $data['productID'] = random_string('alnum', 15);
        $data['manufacture'] = $this->db->get('manufacture');
        $data['category'] = $this->db->get('category');

        $this->form_validation->set_rules('title', 'Title', 'required');
        $this->form_validation->set_rules('price', 'Price', 'required');
        $this->form_validation->set_rules('description', 'Description', 'required');

        if($this->form_validation->run() == FALSE)
        {
            $this->load->view('product/create', $data);
        }
        else
        {
            if($_POST['category'] == 'Notebook')
            {
            $product['product_id'] = $_POST['product_id'];
            $product['title'] = $_POST['title'];
            $product['price'] = $_POST['price'];
            $product['manufacture'] = $_POST['manufacture'];
            $product['category'] = $_POST['category'];

            $notebook['product_id'] = $product['product_id'];
            $notebook['description'] = $_POST['description'];

            $this->db->insert('product', $product);
            $this->db->insert('notebook_detail', $notebook);

            redirect('store/product');
            }
        }
    }
}
?>

View:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
&lt;html &gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /&gt;
&lt;title&gt;Store / Add New Product&lt;/title&gt;
&lt;link href="../../../../../style/store.css" rel="stylesheet" type="text/css" media="screen" /&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;?=validation_errors();?&gt;
&lt;?=form_open('store/product/create')?&gt;
<table cellspacing="2">
  <tr>
    <td colspan="2">Product Information</td>
  </tr>
  <tr>
    <td>Title</td>
    <td><div align="left">
      &lt;input type="text" name="title" value="" size="" /&gt;
    </div></td>
  </tr>
  <tr>
    <td>Price</td>
    <td><div align="left">
      &lt;input type="text" name="price" value="" size="" /&gt;
    </div></td>
  </tr>
  <tr>
    <td>Description</td>
    <td><div align="left">
      &lt;input type="text" name="description&gt;" />
    </div></td>
  </tr>
  <tr>
    <td>Manufacture</td>
    <td>
      <div align="left">
        <select name="manufacture">
          &lt;?
           foreach($manufacture->result() as $row):
            echo '<option value="'.$row->manufacture.'">'.$row->manufacture.'</option>';
           endforeach;
       ?&gt;
          </select>
      </div></td>
  </tr>
  <tr>
    <td>Category</td>
    <td>
      <div align="left">
        <select name="category">
          &lt;?
           foreach($category->result() as $row):
            echo '<option value="'.$row->category.'">'.$row->category.'</option>';
           endforeach;
       ?&gt;
          </select>
       </div></td>
  </tr>
  <tr>
    <td colspan="2"><div align="right">&lt;input type="hidden" name="product_id" value="&lt;?=$productID?&gt;"/&gt;&lt;input type="submit" value="Submit" /></div></td>
  </tr>
</table>
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
#2

[eluser]Michael Nielsen[/eluser]
I'm auto loading all the helpers and libraries.
#3

[eluser]TheFuzzy0ne[/eluser]
I think the code is irrelevant. What we need to see, is the URL you're using when the error happens.
#4

[eluser]wiredesignz[/eluser]
The "description" input is malformed?
#5

[eluser]Michael Nielsen[/eluser]
[quote author="TheFuzzy0ne" date="1242570574"]I think the code is irrelevant. What we need to see, is the URL you're using when the error happens.[/quote]

This is the url...

Code:
http://localhost/CodeIgniter/index.php/store/product/create
#6

[eluser]Michael Nielsen[/eluser]
@wiredesignz Thank you. Had to remove '>' and it solved the prob!




Theme © iAndrew 2016 - Forum software by © MyBB