Mysql save/load but there are no post and name fields

I am currently working with a form and strangely there are no name fields and also no $POST fields. I have no idea how it is saving and loading the values. I think the form does this with the below files.

**views/view.php**

http://jsfiddle.net/ty9f7y9u/

**models/mdl_quotes.php**

http://jsfiddle.net/4vngkegm/1/

**controllers/ajax.php**

http://jsfiddle.net/forv452m/1/

**controllers/quotes.php**

http://jsfiddle.net/1gjc3q6n/

PS: All fiddles are not working but just placeholders. Files where to big for SO.

I want to add an input field and save this to the database and retrieve it. How should I adapt the codes above and where. I am now trying to figure this out for 2 days but still no luck. So I hope the community can help.

Thanks in advance for helping.

Answer

Your JS is currently doing the post for you.

See this:

$.post("<?php echo site_url('quotes/ajax/save'); ?>", {
            quote_id: <?php echo $quote_id; ?>,
            quote_number: $('#quote_number').val(),
            quote_date_created: $('#quote_date_created').val(),
            quote_date_expires: $('#quote_date_expires').val(),
            quote_status_id: $('#quote_status_id').val(),
            items: JSON.stringify(items),
            custom: $('input[name^=custom]').serializeArray()
        },

I haven’t gone through the entire code but I guess the POST values are being accessed like

this->input->post('quote_id');

Leave a Reply

Your email address will not be published. Required fields are marked *