[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:
<form>
<fieldset>
<legend> <b>Add New Artifact </b></legend>
<?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');
?>
</fieldset>
</form>
Model for the form:
Code:
<?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;
}
}
?>
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!