Jump to content

steaphann

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Everything posted by steaphann

  1. 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!
×
×
  • 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.