Jump to content

Database problem


steaphann

Recommended Posts

Hi am working on a seat reservation project. I am making this project in code_igniter. Now I have a little problem with sending the seat label through the database. In my project there is a little JQuery part. When I check a checkbox, the name will be placed on a label. But when I send it to the database it always returns 0 ???

 

This is my jquery function. The first part is to uncheck all other checkboxes if one of the checkbox is checked, and the second part is to put the value of the checkbox into a inputbox.

 

   

    function process(){
                var l = $('[name=check]:checked').length;
                if(l>=1){
                    $('[name=check]').each(function(i,d){
                        if(!$(d).is(":checked")){
                            $(d).attr('disabled','disabled');

                        }
                    });
                }else{
                    $('[name=check]').each(function(i,d){
                        $(d).removeAttr('disabled');
                    });
                }
                       $("#seatDiv").html($(this).val());
                     $(document).ready(function() {
                        $("input[name=check]").change(function() {
                        $("#seatDiv").html($(this).val());
                        })
                     });

            }

My form

 

   <?php
            echo form_open('user/register');
            $username = array(
               'name'       =>  'reg_username',
                'id'        =>  'reg_username',
                'value'     =>  set_value('reg_username')
            );
               $email = array(
               'name'       =>  'reg_email',
                'id'        =>  'reg_email',
                'value'     =>  set_value('reg_email')
            );
                $gsmnummer = array(
               'name'       =>  'reg_gsmnummer',
                'id'        =>  'reg_gsmnummer',
                'value'     =>  set_value('reg_gsmnummer')
            );
                $zitplaats = array(
               'name'       =>  'reg_zitplaats',
                'id'        =>  'reg_zitplaats',
                'value'     =>  ''
            );
        ?>
        <table>
            <tr>
                <td><label> Naam </label></td>
               <td> <div> <?php echo form_input($username); ?></div></td>
           </tr>
            <tr>
                <td><label>e-mail </label></td>
                <td><div> <?php echo form_input($email); ?></div></td>
            </tr>
            <tr>
                <td><label> gsm-nummer </label></td>
                <td><div> <?php echo form_input ($gsmnummer); ?> </div></td>
            </tr>
            <tr>
                <td><label>zitplaats</label></td>
             
                <td><div id="seatDiv" > <?php echo form_input($zitplaats); ?> </div></td>
            </tr>
            <tr>
           <td> <?php echo form_submit(array('name'=> 'verzend','value' => 'verzend')); ?> </td>
  
          <?php echo form_close(); ?>
           </tr>
        </table>

         <?php echo form_close(); ?>

And my user_model

 

class User_model extends Model{
    function User_model() {
        parent :: Model() ;
    }
    function register_user($username, $email, $gsmnummer, $zitplaats){
        
        $query_str ="INSERT INTO tbl_reservering (username,gsmnummer,email,zitplaats)VALUES(?, ?, ?, ?)";
        $this->db->query($query_str,array($username,$email,$gsmnummer,$zitplaats));
    }
}

 

Hope anyone can help me!

 

thank you!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.