CodeIgniter Forums
The URI you submitted has disallowed characters. - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: The URI you submitted has disallowed characters. (/showthread.php?tid=31157)



The URI you submitted has disallowed characters. - El Forum - 06-08-2010

[eluser]Bhavani Shekhawat[/eluser]
I already have a login and a registration form which takes in the data from the user and inserts into the database. However, this is not the case where I have one more form that just has to simply take in the other inputs from the user and put it in a separate table. Whenever I am trying to feed in the data into the database through the form this is what I am getting:

<i> The URI you submitted has disallowed characters. </i>

The form:
Code:
&lt;form&gt;
<fieldset>
    <legend> <b>Add New Artifact </b></legend>
&lt;?php
echo "<br></br>";
echo form_open('site/add_artifact');

echo form_label('Enter Artifact Name:      ', 'ArtifactName');
echo form_input('ArtifactName', set_value('ArtifactName', 'Required'));

echo "<br></br>";

echo form_label('Enter Artifact Description:      ', 'Description');
echo form_input('Description', set_value('Description', 'Required'));

echo "<br></br>";

echo form_label('Enter Artifact Category:      ', 'Category');
echo form_input('Category', set_value('Category', 'Required'));

echo "<br></br>";

echo form_label('Enter Artifact Condition:      ', 'Condition');
echo form_input('Condition', set_value('Condition', 'Required'));

echo "<br></br>";

echo form_label('Enter Acquired Date:      ', 'AcquiredDate');
echo form_input('AcquiredDate', set_value('AcquiredDate', 'Required'));

echo "<br></br>";

echo form_label('Enter Entry Date:      ', 'EnteredDate');
echo form_input('EnteredDate', set_value('EnteredDate', 'Required'));

echo "<br></br>";

echo form_label('Enter Retired Date:      ', 'RetiredDate');
echo form_input('RetiredDate', set_value('RetiredDate', 'Required'));

echo "<br></br>";

echo form_label('Enter Any Comments:      ', 'Comments');
echo form_textarea('Comments', set_value('Comments', 'Write your comments'));  

echo "<br></br>";

echo form_submit('submit', 'Enter Artifact');
?&gt;
</fieldset>
&lt;/form&gt;

Model for the form:
Code:
&lt;?php

class Artifact_model extends Model{
    
    function insert_artifact()
    {    //Adds new artifact
        
        $new_artifact_insert_data = array(
            'ArtifactName' => $this->input->post('ArtifactName'),
            'Description' => $this->input->post('Description'),
            'Category' => $this->input->post('Category'),
            'Condition' => $this->input->post('Condition'),
            'EnteredDate' => $this->input->post('EnteredDate'),
            'AcquiredDate' => $this->input->post('AcquiredDate'),
            'RetiredDate' => $this->input->post('RetiredDate'),
            'Comments' => $this->input->post('Comments')
                );
                
          $insert = $this->db->insert('artifact', $new_artifact_insert_data);
          return $insert;
    }
}

?&gt;

Controller for the form:
Code:
function add_artifacts()
       {
       $this->members_area();
       $this->load->model('artifact_model');
       $this->artifact_model->insert_artifact();    
       $this->load->view('my_artifacts');    
      }
      
      function add_artifacts_validation(){   // validates artifact data
          
      $this->form_validation->set_rules('ArtifactName', 'Required', 'trim|required');
      $this->form_validation->set_rules('Description', 'Required', 'trim|required');
      $this->form_validation->set_rules('Category', 'Required', 'trim|required');
      $this->form_validation->set_rules('Condition', 'Required', 'trim|required');
      $this->form_validation->set_rules('EnteredDate', 'Required', 'trim|required');
      $this->form_validation->set_rule('AcquiredDate', 'Required', 'trim|required');
      $this->form_validation->set_rules('RetiredDate', 'Required', 'trim|required');
      $this->form_validation->set_rules('Comments', 'Required', 'trim|required');
      
      if ($this->run->form_validation() == FALSE)
          {
              $this->add_artifacts();
          }
          else
              {
                  $this->load->model('artifact_model');
                  $this->artifact_model->insert_artifact();
              }
          
      }

I am using the latest version of CI and the latest php version. Would really appreciate if someone can point out the problem. Thanks!


The URI you submitted has disallowed characters. - El Forum - 06-08-2010

[eluser]steelaz[/eluser]
Try changing &lt;form&gt; to &lt;form method="POST"&gt;, you should also add "action" parameter.


The URI you submitted has disallowed characters. - El Forum - 06-08-2010

[eluser]Burak Guzel[/eluser]
You just need to remove the "&lt;form&gt;" from your view (the first line).

You are already calling form_open(), which correctly creates a POST form tag, instead of the default GET (which causes the error you are having).

Another unrelated problem: Your form_open() links to 'site/add_artifact', while in fact your controller is named 'site/add_artifacts'.


The URI you submitted has disallowed characters. - El Forum - 06-08-2010

[eluser]Bhavani Shekhawat[/eluser]
K let me try this...if this works you are life savior!


The URI you submitted has disallowed characters. - El Forum - 06-08-2010

[eluser]Bhavani Shekhawat[/eluser]
[quote author="Burak Guzel" date="1276052640"]You just need to remove the "&lt;form&gt;" from your view (the first line).

You are already calling form_open(), which correctly creates a POST form tag, instead of the default GET (which causes the error you are having).

Another unrelated problem: Your form_open() links to 'site/add_artifact', while in fact your controller is named 'site/add_artifacts'.[/quote]

Problem solved. It was the &lt;form&gt; thing. Thanks a lot man!
p.s. thanks for the artifact typo too!