Jump to content


rodrigoselau

Member Since 29 Sep 2016
Offline Last Active Sep 30 2016 06:44 PM
-----

Posts I've Made

In Topic: [ANSWERED] set_relation and "Add New" button to quick insert.

30 September 2016 - 02:28 PM

I am having difficulty in this code, it sends the information to the "quick_add_ssid_save", only it is not added to the information in the database, the following code:

function quick_add_ssid()
	{

		$javascript = '
			<script>
			function do_quick_ssid_add()
			{
			var ssid_text = $(\'#ssid_nome\').val();
			var ssid_crip = $(\'#ssid_crip\').val();

			$.post(\''.site_url().'/admin/ptp1610/index/quick_add_ssid_save/\', { ssid_nome: ssid_text, ssid_crip: ssid_crip }, function(data) {
				$(\'#ssid_message\').html(\'Successfully inserted a new category\');
			});
			}
			</script>
			';

		$html = '
			<div style="width: 400px; height: 250px;">
			<div style="padding: 5px;">Novo SSID:</div>
			<div style="padding: 5px;"><input type="text" name="ssid_nome" id="ssid_nome"></div>
			<div style="padding: 5px;">Nova Criptografia:</div>
			<div style="padding: 5px;"><input type="text" name="ssid_crip" id="ssid_crip"></div>
			<div style="padding: 5px;"><input type="button" value="Add &raquo;" onclick="do_quick_ssid_add();"> <span id="ssid_message"></span></div>
			</div>
			';

		echo $javascript.$html;
		exit;
	}

		function quick_add_ssid_save()
		{
			//POST ITEMS //only needed if adding a sub category, can get parent ID
			$ssid_nome = $this->input->post('ssid_nome', true);
			$ssid_crip = $this->input->post('ssid_crip', true);
			$data = array(
        		'idSsid_crip' => NULL,
        		'ssid' => 'ssid_nome',
        		'crip' => 'ssid_crip'
			);

			$this->db->insert('csm_Ssid_crip', $data);
	}

Thank you very much in advance

:D