Khi mình chọn patient thì address phải thay đổi theo mình mình làm như thế nào ạ
Chọn patient thì thay đổi address
-
Phím PrintScreen trên bàn phím của bạn bị liệt hả?
-
Code của bạn đâu?
3 Likes
Bạn up code lên đây dưới dạng text, không up dưới dạng hình.
2 Likes
code patient
<div class="form-group col-md-4">
<label for="exampleInputEmail1"> <?php echo lang('patient'); ?></label>
<select class="form-control m-bot15 js-example-basic-single" name="patient" value=''>
<?php foreach ($patients as $patient) { ?>
<option value="<?php echo $patient->id; ?>" <?php
if (!empty($setval)) {
if ($patient->id == set_value('patient')) {
echo 'selected';
}
}
if (!empty($prescription->patient)) {
if ($patient->id == $prescription->patient) {
echo 'selected';
}
}
?> > <?php echo $patient->name; ?> </option>
<?php } ?>
</select>
</div>
code address
<?php if (!$this->ion_auth->in_group('address')) { ?>
<div class="form-group col-md-4">
<label for="exampleInputEmail1"> <?php echo lang('address'); ?></label>
<select class="form-control m-bot15 js-example-basic-single" name="address" value=''>
<?php foreach ($patients as $patients) { ?>
<option value="<?php echo $patients->id; ?>" <?php
if (!empty($setval)) {
if ($patients->id == set_value('address')) {
echo 'selected';
}
}
if (!empty($prescription->address)) {
if ($patients->id == $prescription->address) {
echo 'selected';
}
}
?> > <?php echo $patients->address; ?> </option>
<?php } ?>
</select>
</div>
<?php } else { ?>
<div class="form-group col-md-4">
<label for="exampleInputEmail1"> <?php echo lang('address'); ?></label>
<select class="form-control m-bot15 js-example-basic-single" name="address" value=''>
<?php
foreach ($patients as $patients) {
if ($patients->id == $patients) {
?>
<option value="<?php echo $patients->id; ?>" <?php
if (!empty($setval)) {
if ($patients->id == set_value('address')) {
echo 'selected';
}
}
if (!empty($prescription->address)) {
if ($patients->id == $prescription->address) {
echo 'selected';
}
}
?> > <?php echo $patients->address; ?> </option>
<?php
}
}
?>
</select>
</div>
<?php } ?>
Phần này bạn cần đến Javascript và Ajax (front-end), chỉ PHP không giúp gì cho bạn đâu.
4 Likes
This topic was automatically closed after 23 hours. New replies are no longer allowed.