Why modal bootstrap on table data doesn't showing / fetching match data when popup? - forms

Please check this image
I try to fetching data on every table data using modal bootstrap, but when i click every modal button it's just showing last table data in form of my popup modal. I want the data is per in the form on modal bootstrap. I am using CodeIgniter. Please help me, thanks. GBU
HERE IS MY CODE:
<table class="table table-bordered table-striped nowrap text-gray-900" id="dataTable" width="100%" style="font-size: 13px;" cellspacing="0">
<thead>
<tr class="table-success">
<th>ID</th>
<th>NOMOR</th>
<th>KODE</th>
<th>TINDAKAN</th>
<th>AKSI</th>
</tr>
</thead>
<tbody>
<?php
foreach ($prosedur_rehab as $rehab) {
?>
<tr>
<td><?= $rehab->ID; ?></td>
<td><?= $rehab->NOMOR; ?></td>
<td><?= $rehab->KODE; ?></td>
<td><?= $rehab->TINDAKAN; ?></td>
<td>
<button type="button" class="btn btn-sm btn-info" data-toggle="modal" data-target="#perawat<?php echo $rehab->ID;?> ">
<i class="fas fa-user-nurse"></i>
</button>
<div class="modal fade" id="perawat<?php echo $rehab->ID;?>" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true" >
<div class="modal-dialog modal-lg" >
<div class="modal-content">
<div class="modal-header" style="background-color:#5bc0de">
<h5 class="modal-title" id="exampleModalLabel">Kelola Rawat Jalan (Diisi Oleh Perawat)</h5>
<button type="button" class="btn-danger" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<form method="post" action="<?php echo base_url().'dokter/kunjungan/kirimlaprajal'?>">
<div class="form-group">
<!-- <label for="exampleInputEmail1">ID</label> -->
<select name="" class="form-control">
<option>-- CARI --</option>
<?php foreach ($prosedur_rehab as $rehab):?>
<option value="<?php echo $rehab->ID?>"><?php echo $rehab->ID?> || <?php echo $rehab->NORM?></option>
<?php endforeach ?>
</select>
</div>
<div class="form-group">
<label for="exampleInputEmail1">ID Prosedur</label>
<input type="text" name="ID" class="form-control" id="exampleInputEmail1" required readonly autocomplete="off" value="<?php echo $rehab->ID; ?>">
</div>
<div class="row">
<div class="col-6">
<div class="form-group">
<label for="exampleInputEmail1">No. Pendaftaran</label>
<input type="text" name="NOMOR" class="form-control" id="exampleInputEmail1" required readonly autocomplete="off" value="<?php echo $rehab->NOMOR; ?>">
</div>
<div class="form-group">
<label for="exampleInputEmail1">Kode</label>
<input type="text" name="KODE" class="form-control" id="exampleInputEmail1" required readonly autocomplete="off" value="<?php echo $rehab->KODE; ?>">
</div>
<div class="form-group">
<label for="exampleInputEmail1">Tindakan</label>
<input type="text" name="TINDAKAN" class="form-control" id="exampleInputEmail1" autocomplete="off" value="<?php echo $rehab->TINDAKAN; ?>">
</div>
<div class="form-group">
<label for="exampleInputEmail1">Tanggal</label>
<input type="datetime-local" name="TANGGAL" class="form-control" id="exampleInputEmail1" required autocomplete="off" placeholder="" value="">
</div>
<div class="form-group">
<label for="exampleInputEmail1">Instrumen Uji Fungsi</label>
<input type="text" name="PROGRAM" class="form-control" id="exampleInputEmail1" required autocomplete="off" value="">
</div>
<div class="form-group">
<label for="exampleInputEmail1">Hasil</label>
<input type="text" name="HASIL" class="form-control" id="exampleInputEmail1" required autocomplete="off" placeholder="" value="">
</div>
</div>
<div class="col-6">
<div class="form-group">
<label for="exampleInputEmail1">Kesimpulan</label>
<input type="text" name="KESIMPULAN" class="form-control" id="exampleInputEmail1" required autocomplete="off" value="">
</div>
<div class="form-group">
<label for="exampleInputEmail1">Rekomendasi</label>
<input type="text" name="REKOMENDASI" class="form-control" id="exampleInputEmail1" required autocomplete="off" value="">
</div>
<div class="form-group">
<label for="exampleInputEmail1">Oleh</label>
<input type="text" name="OLEH" class="form-control" id="exampleInputEmail1" required autocomplete="off" value="<?php echo $session_user->nip ;?>" readonly>
</div>
<div class="form-group">
<label for="exampleInputEmail1">Status</label>
<input type="text" name="STATUS" class="form-control" id="exampleInputEmail1" required autocomplete="off" value="">
</div>
</div>
</div>
<button type="submit" name="simpen" class="btn btn-info float-right"><i class="fas fa-save"> </i> Simpan</button>
</form>
</div>
</div>
</div>
</div>
</td>
</tr>
<?php } ?>
</tbody>
<tfoot>
<tr>
<th>ID</th>
<th>NOMOR</th>
<th>KODE</th>
<th>TINDAKAN</th>
</tr>
</tfoot>
</table>

i tried your code and it works perfectly, Check your $rehave->ID value maybe it doesn't have value or have invalid value, or check your modal plugins

The problem is i was used same foreach in select option . I was forgot if i 've been using first foreach to displaying table data and i used it again in form.
Don't using same foreach in form, delete or change this:
<select name="" class="form-control">
<option>-- CARI --</option>
<?php foreach ($prosedur_rehab as $rehab):?>
<option value="<?php echo $rehab->ID?>"><?php echo $rehab->ID?> || <?php echo $rehab->NORM?></option>
<?php endforeach ?>
</select>

Related

Form Text Input Alignment Issue

I looked at the other forms on here and I still can't seem to get anywhere for whatever reason. I've tried several different methods that I've found on here and nothing is working >.< Can someone help me align these text boxes? Any help is greatly appreciated!
<h1>Registration</h1>
<div class="containter">
<form name=registration>
Username: <input type="text" name="username" value="">
<br><br> Password: <input type="text" name="password" value="">
<br><br> First Name: <input type="text" name="firstName" value="">
<br><br> Last Name: <input type="text" name="lastName" value="">
<br><br> Date of Birth: <input type="text" name="bDay" value="">
<br><br> Email: <input type="text" name="email" value="">
<br><br> Phone Number: <input type="text" name="firstName" value="">
<br><br>
</form>
</div>
You can just put it in a table:
<body>
<h1>Registration</h1>
<div class="containter">
<form name=registration>
<table style="width:100%">
<tr>
<td>Username: </td><td><input type="text" name="username" value=""></td>
</tr>
<tr>
<td>Password: </td><td><input type="text" name="password" value=""></td>
</tr>
<tr>
<td>First Name:</td><td> <input type="text" name="firstName" value=""></td>
</tr>
<tr>
<td>Last Name: </td><td><input type="text" name="lastName" value=""></td>
</tr>
<tr>
<td>Date of Birth: </td><td><input type="text" name="bDay" value=""></td>
</tr>
<tr>
<td>Email: </td><td><input type="text" name="email" value=""></td>
</tr>
<tr>
<td>Phone Number: </td><td><input type="text" name="firstName" value=""></td>
</tr>
</form>
</div>
You may want to use bootstrap and this is what you could get. Checkout this codepen
Bootstrap is used by a lot of companies and is an easier way to create responsive forms
<html>
<head>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet"/>
</head>
<body>
<h1>Registration</h1>
<form name=registration>
<div class="containter">
<div class="form-group row">
<label class="col-sm-2 col-form-labe">Username:</label>
<div class="col-sm-10">
<input class="form-control" type="text" name="username" value="" />
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-labe">Password:</label>
<div class="col-sm-10">
<input class="form-control" type="text" name="password" value="" />
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-labe">First Name:</label>
<div class="col-sm-10">
<input class="form-control" type="text" name="firstName" value="" />
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-labe">Last Name:</label>
<div class="col-sm-10">
<input class="form-control" type="text" name="lastName" value="">
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-labe">Date of Birth:</label>
<div class="col-sm-10">
<input class="form-control" type="date" name="bDay" value="" />
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-labe">Email:</label>
<div class="col-sm-10">
<input class="form-control" type="email" name="email" value="">
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-labe">Phone Number:</label>
<div class="col-sm-10">
<input class="form-control" type="text" name="firstName" value="" />
</div>
</div>
</div>
</form>
</body>
</html>

Bootstrap checkbox in line not aligned

I am trying to design a form but it is not being well formed. I need to make it responsive. But checkbox is not aligned well in horizontal.
<form class="ng-pristine ng-scope ng-pending">
<div class="form-group">
<div class="input-group">
<span class="input-group-addon input_force"><i class="ti-pin"></i></span>
<input type="text" id="mapInput" class="form-control input_force_text_edit ng-pristine ng-untouched ng-isolate-scope ng-pending ng-empty" value="" g-places-autocomplete="" placeholder="Please enter drop off address WITHOUT Apt/Suite number" ng-model="order.drop_off_address"
name="drop_off_address" autocomplete="off" validator="required" aria-invalid="false"><span></span>
<input type="text" id="drop_off_address_line_2" class="form-control ng-pristine ng-untouched ng-valid ng-empty" placeholder="Apartment/Suite etc." ng-model="order.drop_off_address_line_2" name="drop_off_address_line_2" autocomplete="off" aria-invalid="false">
</div>
</div>
<div class="row">
<div class="form-group" style="display: block; width: 100%;">
<div class="col-sm-8">
<div class="input-group" style="width: 100%;">
<span class="input-group-addon"><i class="ti-mobile"></i></span>
<input type="text" id="message_for_driver" class="form-control " placeholder="Message For Driver" ng-model="order.message_for_driver" name="message_for_driver" autocomplete="off" aria-invalid="false" style=" width: 100%;">
</div>
</div>
<div class="col-md-3">
<div class="checkbox">
<label >
<input type="checkbox" style="" id="is_ok_to_leave_at_the_door" class="form-control ng-pristine ng-untouched ng-valid ng-empty" checked="checked" ng-model="order.is_ok_to_leave_at_the_door"> Ok to leave at the door
</label>
</div>
</div>
</div>
</div>
</form>
you can checkout my code over this URL.
https://jsfiddle.net/ahmeric/Lrgdk6uh/
here is the solution. You can see the related part in this URL.
https://jsfiddle.net/ahmeric/Lrgdk6uh/5/
<form class="ng-pristine ng-scope ng-pending">
<div class="form-group">
<div class="input-group">
<span class="input-group-addon input_force"><i class="ti-pin"></i></span>
<input type="text" id="mapInput" class="form-control input_force_text_edit ng-pristine ng-untouched ng-isolate-scope ng-pending ng-empty" value="" g-places-autocomplete="" placeholder="Please enter drop off address WITHOUT Apt/Suite number" ng-model="order.drop_off_address"
name="drop_off_address" autocomplete="off" validator="required" aria-invalid="false"><span></span>
<input type="text" id="drop_off_address_line_2" class="form-control ng-pristine ng-untouched ng-valid ng-empty" placeholder="Apartment/Suite etc." ng-model="order.drop_off_address_line_2" name="drop_off_address_line_2" autocomplete="off" aria-invalid="false">
</div>
</div>
<div class="row mb-5">
<div class="form-group">
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
<div class="input-group">
<span class="input-group-addon"><i class="ti-mobile"></i></span>
<input type="text" id="message_for_driver" class="form-control " placeholder="Message For Driver" ng-model="order.message_for_driver" name="message_for_driver" autocomplete="off" aria-invalid="false" >
</div>
</div>
</div>
<div class="form-group ml-20">
<div class="col-lg-3 col-md-3 col-sm-12 col-xs-12 pull-right pt-5">
<div>
<label class="checkbox-inline">
<input type="checkbox" style="" id="is_ok_leave_at_the_door" checked="checked" ng-model="order.is_ok_leave_at_the_door"> Ok to leave at the door
</label>
</div>
</div>
</div>
</div>
</form>

Creating long forms in Bootstrap to be all one form, instead of multiple forms

I'd like to create a long form that is just all one form instead of a bunch of separate forms. Is this doable? I've reviewed all the Bootstrap Documentation and this seems to be the only way to do it. Does anyone know a way around this? Below is what I have, every field is a separate form, and I need it to be one.
<div class="row-container">
<div class="row">
<div class="field-wrapper">
<form class="form-inline">
<div class="form-group">
<label for="claimnumber">Claim Number</label>
<input type="text" class="form-control" id="claimnumber" placeholder="">
</div>
</form>
</div>
<div class="field-wrapper">
<form class="form-inline">
<div class="form-group">
<label for="insuredid">Insured ID</label>
<input type="text" class="form-control" id="insuredid" placeholder="">
</div>
</form>
</div>
<div class="field-wrapper">
<form class="form-inline">
<div class="form-group">
<label for="claimnumber">Patient ID</label>
<input type="text" class="form-control" id="patientid" placeholder="">
</div>
</form>
</div>
<div class="field-wrapper">
<form class="form-inline">
<div class="form-group">
<label for="lastname">Patient Last Name</label>
<input type="text" class="form-control" id="lastname" placeholder="">
</div>
</form>
</div>
<div class="field-wrapper">
<form class="form-inline">
<div class="form-group">
<label for="lastname">Patient Last Name</label>
<input type="text" class="form-control" id="Text1" placeholder="">
</div>
</form>
</div>
</div>
</div>
<div class="datecontainer">
<div class="date1container">
<div class="dateheading">Service Date</div>
<div class="datebody">
<div class="field-wrapper">
<form class="form-inline">
<div class="form-group">
<label for="lastname">Start</label>
<input type="text" class="form-control calendar" id="date" placeholder="00/00/0000">
</div>
</form>
</div>
<div class="field-wrapper">
<form class="form-inline">
<div class="form-group">
<label for="lastname">End</label>
<input type="text" class="form-control calendar2" id="date2" placeholder="00/00/0000">
</div>
</form>
</div>
</div>
</div>
<div class="date2container">
<div class="dateheading">Import Date</div>
<div class="datebody">
<div class="field-wrapper">
<form class="form-inline">
<div class="form-group">
<label for="lastname">Start</label>
<input type="text" class="form-control calendar3" id="date3" placeholder="00/00/0000">
</div>
</form>
</div>
It works with just one form... check this
http://jsfiddle.net/7LChZ/1/show/
<div class="container">
<form class="form-inline">
<div class="row-container">
<div class="row">
<div class="field-wrapper">
<div class="form-group">
<label for="claimnumber">Claim Number</label>
<input type="text" class="form-control" id="claimnumber" placeholder="" />
</div>
</div>
<div class="field-wrapper">
<div class="form-group">
<label for="insuredid">Insured ID</label>
<input type="text" class="form-control" id="insuredid" placeholder="" />
</div>
</div>
<div class="field-wrapper">
<div class="form-group">
<label for="claimnumber">Patient ID</label>
<input type="text" class="form-control" id="patientid" placeholder="" />
</div>
</div>
<div class="field-wrapper">
<div class="form-group">
<label for="lastname">Patient Last Name</label>
<input type="text" class="form-control" id="lastname" placeholder="" />
</div>
</div>
<div class="field-wrapper">
<div class="form-group">
<label for="lastname">Patient Last Name</label>
<input type="text" class="form-control" id="Text1" placeholder="" />
</div>
</div>
</div>
</div>
<div class="datecontainer">
<div class="date1container">
<div class="dateheading">Service Date</div>
<div class="datebody">
<div class="field-wrapper">
<div class="form-group">
<label for="lastname">Start</label>
<input type="text" class="form-control calendar" id="date" placeholder="00/00/0000" />
</div>
</div>
<div class="field-wrapper">
<div class="form-group">
<label for="lastname">End</label>
<input type="text" class="form-control calendar2" id="date2" placeholder="00/00/0000" />
</div>
</div>
</div>
</div>
<div class="date2container">
<div class="dateheading">Import Date</div>
<div class="datebody">
<div class="field-wrapper">
<div class="form-group">
<label for="lastname">Start</label>
<input type="text" class="form-control calendar3" id="date3" placeholder="00/00/0000" />
</div>
</div>
</div>
</div>
</div>
</form>
</div>
What I change is, I remove all form tags and wrap them all with just one.
You should only use one <form> -tag and not multiple ones if you only need one form. You should place it after <div class="row">. And don't forget to close it correctly!

How to align label on same line as form?

I have the following code for login screen using bootstrap. Please help in aligning the label in the same line as the form input field.
<div class="container">
<div class="row">
<div class="col-md-6">
<div>
<form class="form-horizontal">
<fieldset>
<legend>Existing Customer</legend>
<div class="control-group">
<label class="control-label" for="user">User Name:</label>
<div class="control-group">
<input type="text" class="textbox" id="user">
</div>
<label class="control-label" for="pwd">Password:</label>
<div class="controls">
<input type="text" class="textbox" id="pwd">
</div>
<div class="controls">
<input class="btn btn-primary" name="commit" type="submit" value="Log In" />
</div>
</div>
</fieldset>
</form>
</div>
</div>
<div class="col-md-6">
<legend>New Customer</legend>
</div>
Hi use table which solves your alignment issues.
-------------------------------------------------------------
<html>
<head>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-6">
<div>
<form class="form-horizontal">
<fieldset>
<legend>Existing Customer</legend>
<table>
<tr>
<td>
<div class="control-group">
<label class="control-label" for="user">User Name:</label>
</td>
<td>
<div class="control-group">
<input type="text" class="textbox" id="user">
</div>
</td>
</tr>
<tr>
<td>
<label class="control-label" for="pwd">Password:</label>
</td>
<td>
<div class="controls">
<input type="text" class="textbox" id="pwd">
</div>
</td>
</tr>
<div class="controls">
<input class="btn btn-primary" name="commit" type="submit" value="Log In" />
</div>
</div>
</table>
</fieldset>
</form>
</div>
</div>
<div class="col-md-6">
<legend>New Customer</legend>
</div>
</body>
i think you should take css from ui expert and move forward in your project. the page
lay out should be designed as the developer only should be able to use(apply) the css in
the UI layer
Here is the code using Bootstrap 3:
<div class="container">
<div class="row">
<div class="col-md-6">
<form class="form-horizontal" role="form">
<fieldset>
<legend>Existing Customer</legend>
<div class="form-group">
<label class="col-sm-2 control-label" for="user">User Name:</label>
<div class="col-sm-4">
<input type="text" class="textbox form-control" id="user">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="pwd">Password:</label>
<div class="col-sm-4">
<input type="text" class="textbox form-control" id="pwd">
</div>
</div>
<div class="form-group">
<input class="btn btn-primary" name="commit" type="submit" value="Log In" />
</div>
</fieldset>
</form>
</div>
<div class="col-md-6">
<legend>New Customer</legend>
</div>
</div>
and the respective fiddle: http://jsfiddle.net/G2cgf/
Submit a margin-left to the button, like this:
<input class="btn btn-primary" name="commit" type="submit" value="Log In" style="margin-left: 15px;"/>

HTML/PHP Form Formatting Error

im new so don't go to hard on me here. I'm trying to make this registration form into two rows but every time i try it does not post all the values from both rows of the form, just the first.
http://i.stack.imgur.com/TSnjl.png
<table width="990" border="0">
<tr>
<td width="486" height="221"><form id='register' action='<?php echo $fgmembersite->GetSelfScript(); ?>' method='post' accept-charset='UTF-8'>
<fieldset >
<legend>Register</legend>
<input type='hidden' name='submitted' id='submitted' value='1'/>
<div class='short_explanation'>* required fields</div>
<input type='text' class='spmhidip' name='<?php echo $fgmembersite->GetSpamTrapInputName(); ?>' />
<div class="container"><span class='error'><?php echo $fgmembersite->GetErrorMessage(); ?></span>
<label for='name' >Your First Name*: </label>
<br/>
<input type='text' name='name' id='name' value='<?php echo $fgmembersite->SafeDisplay('name') ?>' maxlength="50" />
<br/>
</div>
<div class='container'>
<label for='lastname' >Your Last Name*: </label>
<br/>
<input type='text' name='lastname' id='lastname' value='<?php echo $fgmembersite->SafeDisplay('lastname') ?>' maxlength="50" />
<br/>
<span id='register_name_errorloc' class='error'></span> </div>
<div class='container'>
<label for='email' >Email Address*:</label>
<br/>
<input type='text' name='email' id='email' value='<?php echo $fgmembersite->SafeDisplay('email') ?>' maxlength="50" />
<br/>
<span id='register_email_errorloc' class='error'></span> </div>
<div class='container'>
<label for='username' >UserName*:</label><br/>
<input type='text' name='username' id='username' value='<?php echo $fgmembersite->SafeDisplay('username') ?>' maxlength="50" /><br/>
<span id='register_username_errorloc' class='error'></span>
<br/>
<span id='register_username_errorloc' class='error'></span> </div>
<div class='container' style='height:80px;'>
<label for='password' >Password*:</label>
<br/>
<div class='pwdwidgetdiv' id='thepwddiv' ></div>
<noscript>
<input type='password' name='password' id='password' maxlength="50" />
</noscript>
<div id='register_password_errorloc' class='error' style='clear:both'></div>
</div>
<input type='text' class='spmhidip' name='<?php echo $fgmembersite->GetSpamTrapInputName(); ?>2' />
<div class="container">
<p><span class='error'><?php echo $fgmembersite->GetErrorMessage(); ?></span>
<label for='phonenumber' >Phone Number: </label>
<br/>
<input type='text' name='phonenumber' id='phonenumber' value='<?php echo $fgmembersite->SafeDisplay('phonenumber') ?>' maxlength="15" />
<br/>
</p>
</div>
<div class='container'>
<label for='address' >Address: </label>
<br/>
<input type='text' name='address' id='address' value='<?php echo $fgmembersite->SafeDisplay('address') ?>' maxlength="40" />
<br/>
</div>
<div class='container'>
<label for='city' >City:</label>
<br/>
<input type='text' name='city' id='city'value='<?php echo $fgmembersite->SafeDisplay('city') ?>' maxlength="20">
<br/>
</div>
<div class='container'>
<label for='State' >State:</label>
<br/>
<input type='text' name='state' id='state' value='<?php echo $fgmembersite->SafeDisplay('state') ?>' maxlength="2" />
</div>
<div class='container'>
<label for='State' >Country:</label>
<br/>
<input type='text' name='country' id='country' value='<?php echo $fgmembersite->SafeDisplay('country') ?>' maxlength="3" />
<br/>
</div>
<div class='container' style='height:80px;'>
<p>
<label for='zip' >ZipCode:</label>
<br/>
<input type='text' name='zipcode' id='zipcode' value='<?php echo $fgmembersite->SafeDisplay('lastname') ?>' maxlength="5" />
</p>
<div class='container'>
<input type='submit' name='Submit' value='Submit' />
</div>
<p> </p>
</div>
</fieldset>
</form></td>
<td width="494" valign="top"><h2> </h2></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
</table>
I think possible the error is in the way u use double quotes and single quotes.
value='<?php echo $fgmembersite->SafeDisplay('username') ?>'
should be changed to
value="<?php echo $fgmembersite->SafeDisplay('username') ?>"
Could you report back to me what happens if you do this in all the cases