Boostrap Modal Does not opening when click on edit button - php

i have been making a crud application using php , mysql and bootstrap. everything is working fine but when i click on edit option the model does not open.i can understand why this is happening.
this is happening when i click on edit button. no modal is showing
Bootstrap modal not showing
code of edit button
<span class="glyphicon glyphicon-edit" style="color: #fff;"></span>
modal code
<div class="modal fade" id="edit<?php echo $row['userid']; ?>" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<center><h4 class="modal-title" id="myModalLabel">Edit</h4></center>
</div>
<div class="modal-body">
<?php
$edit=mysqli_query($conn,"select * from customer_record where userid='".$row['userid']."'");
$erow=mysqli_fetch_array($edit);
?>
<div class="container-fluid">
<form method="POST" action="edit.php?id=<?php echo $erow['userid']; ?>">
<div class="row">
<div class="col-md-3">
<div class="form-group">
<label>NAME</label>
<input type="text" name="name" class="form-control" value="<?php echo $erow['name']; ?>">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label>PHONE</label>
<input type="text" name="phone" class="form-control" value="<?php echo $erow['phone']; ?>" >
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label>PRODUCT</label>
<input type="text" name="product" class="form-control" value="<?php echo $erow['product']; ?>" >
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label>CLIENT NAME</label>
<select type="text" name="client" class="form-control" value="<?php echo $erow['client']; ?>">
<option>select</option>
<option> Carrefour FORT - L </option>
<option> Carrefour EMP - L </option>
<option> Carrefour PKJS - L </option>
<option> Carrefour LYPR - F </option>
<option> Carrefour WTC - I</option>
<option> Carrefour PAL - K</option>
<option> Carrefour L.ONE -K</option>
<option> Hyundai </option>
<option> Kenwood </option>
<option> Canon </option>
<option> Cash </option>
<option> Multynet </option>
<option> Panasonic</option>
</select>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label>ADDRESS</label>
<input type="text" name="address" class="form-control" value="<?php echo $erow['address']; ?>">
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<label>ZONE AREA</label>
<select name="zone_area" class="form-control" value="<?php echo $erow['zone_area']; ?>">
<option>select</option>
<option>A</option>
<option>B</option>
<option>C</option>
<option>D</option>
<option>E</option>
<option>F</option>
<option>G</option>
<option>H</option>
<option>I</option>
<option>J</option>
<option>NA</option>
</select>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label>DELIVERY DATE</label>
<input type="date" name="delivery_date" class="form-control" value="<?php echo $erow['delivery_date']; ?>">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label>DELIVERY STATUS</label>
<select name="delivery_status" class="form-control" value="<?php echo $erow['delivery_status']; ?>">
<option>select</option>
<option> Self Carry </option>
<option> Pending </option>
<option> Lift Back</option>
<option> Deliverd</option>
<option> Deliverd in 2nd attempt</option>
</select>
</div>
</div>
</div>
<div class="row">
<div class="col-md-3">
<div class="form-group">
<label>INVOICE #</label>
<input type="text" name="invoice" class="form-control" value="<?php echo $erow['invoice']; ?>">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label>VEHICLE #</label>
<select type="text" name="vehicle" class="form-control" value="<?php echo $erow['vehicle']; ?>">
<option>select</option>
<option> RIN - 4546 </option>
<option> LES - 2200 </option>
<option> LES - 8732 </option>
<option> LES - 5884 </option>
<option> LES - 4964 </option>
<option> LES - 2150 </option>
</select>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label>COUPAN #</label>
<input type="text" name="coupan" class="form-control" value="<?php echo $erow['coupan']; ?>">
</div>
</div>
</div>
<div class="row">
<div class="col-md-3">
<div class="form-group">
<label>INSTALLER NAME</label>
<input type="text" name="installername" class="form-control" value="<?php echo $erow['installername']; ?>">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label>Installation Date</label>
<input type="date" name="installationdate" class="form-control" value="<?php echo $erow['installationdate']; ?>">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label>INSTALLATION STATUS</label>
<select name="installationstatus" class="form-control" value="<?php echo $erow['installationstatus']; ?>">
<option>select</option>
<option>PROCESSED</option>
<option>COMPLETED</option>
<option>FAILED</option>
<option>Installed in 2nd Attempt</option>
</select>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label>Remarks ( Delivery + installation )</label>
<input type="text" id="remarks" name="remarks" class="form-control" value="<?php echo $erow['remarks']; ?>">
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal"><span class="glyphicon glyphicon-remove"></span> Cancel</button>
<button type="submit" class="btn btn-warning"><span class="glyphicon glyphicon-check"></span> Save</button>
</div>
</form>
</div>
</div>
</div>
the plugins i used

The following article is an answer to a similiar question, you might wanna take a look: https://stackoverflow.com/a/16095583/12739653
If it didn't help you. Please provide some general information; Did you import all required files, what's your Bootstrap version?
If you're using Bootstrap 5, you might need to use data-bs-target and data-bs-toggle instead. Learn more here: https://getbootstrap.com/docs/5.0/components/modal/#live-demo

Just make sure that your <div class="modal fade" ...> is inside the <body>.

Related

How to get an array from form data

I am using Metronic Form Repeater in our project.
My form tag doesn't have any encryption or content type.
<form class="m-form" action="<?php echo $action; ?>" method='POST'></form>
When I submit the form, I can see our data like below
Unfortunately, when I print the $_POST, I see an empty array.
Form Code
<div class="form-group m-form__group row" id="m_repeater_1">
<div data-repeater-list="" class="col-lg-12">
<div data-repeater-item class="form-group m-form__group row align-items-center">
<div class="col-md-3">
<div class="m-form__group m-form__group--inline">
<div class="m-form__label">
<label>Column Name</label>
</div>
<div class="m-form__control">
<input type="name" name="col_name" class="form-control m-input" placeholder="Enter full name">
</div>
</div>
<div class="d-md-none m--margin-bottom-10"></div>
</div>
<div class="col-md-4">
<div class="m-form__group m-form__group--inline">
<div class="form-group m-form__group row">
<label class="col-form-label col-lg-3 col-sm-12">Data Type</label>
<div class="col-lg-6 col-md-9 col-sm-6">
<select class="form-control m-select2" id="m_select2_1" name="param">
<option value='TINYINT'>TINYINT</option>
<option value='SMALLINT'>SMALLINT</option>
<option value='MEDIUMINT'>MEDIUMINT</option>
</select>
</div>
</div>
</div>
<div class="d-md-none m--margin-bottom-10"></div>
</div>
<div class="col-md-3">
<div class="m-form__group m-form__group--inline">
<div class="m-form__label">
<label>Length</label>
</div>
<div class="m-form__control">
<input type="number" name="col_long" class="form-control m-input" placeholder="Uzunluk Giriniz">
</div>
</div>
<div class="d-md-none m--margin-bottom-10"></div>
</div>
<div class="form-group m-form__group col-md-3">
<label for="exampleSelect1">Default</label>
<select class="form-control m-input" id="exampleSelect1" name="col_def">
<option value='1'>NoDefault</option>
<option value='2'>NULL</option>
<option value='3'>CURRENT_TIMESTAMP</option>
<option value='4'>ON UPDATE CURRENT_TIMESTAMP</option>
<option value='5'>AUTO_INCREMENT</option>
</select>
</div>
</div>
</div>
</div>

How to make dynamic bootstrap modal work on Iphones?

There is problem in opening bootstrap modal in iphones.
If i use static modal like below,
<a href="#responsive" data-toggle="modal"><button class="btn btn-green ">Add Product<i class="fa fa-plus"></i></button>
</a>
<!-- start: BOOTSTRAP EXTENDED MODALS -->
<div id="responsive" class="modal extended-modal fade no-display">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
×
</button>
<h4 class="modal-title" style="color:red">Add New Product</h4>
</div>
<div class="modal-body">
<div class="row">
<form name="new" action="<?php echo base_url() ?>admin/addProduct" method="post" enctype="multipart/form-data" autocomplete="off">
<div class="col-md-6">
<h4><b>Category Name <span class="symbol required"></span></b></h4>
<p>
<select class="form-control" name="cat_id" required>
<option value="">---- Select Category ----</option>
<?php foreach($cat['list'] as $rows=>$value){ ?>
<option value="<?php echo $cat['list'][$rows]->cat_id; ?>"><?php echo ucwords($cat['list'][$rows]->cat_name); ?></option>
<?php } ?>
</select>
</p>
</div>
<div class="col-md-6">
<h4><b>Product Name <span class="symbol required"></span></b></h4>
<p>
<input class="form-control" type="text" name="item_name" required>
</p>
</div>
<div class="col-md-6">
<h4><b>Small Description <span class="symbol required"></span></b></h4>
<p>
<input class="form-control" type="text" name="small_desc">
</p>
</div>
<div class="col-md-6">
<h4><b>Quantity<span class="symbol required"></span></b></h4>
<p>
<input class="form-control" type="number" name="quantity" required min="1">
</p>
</div>
<div class="col-md-6">
<h4><b>Customer Price<span class="symbol required"></span></b></h4>
<p>
<input class="form-control" type="number" name="price" required min="1">
</p>
</div>
<div class="col-md-6">
<h4><b>Reseller Price<span class="symbol required"></span></b></h4>
<p>
<input class="form-control" type="number" name="reseller" required min="1">
</p>
</div>
<div class="col-md-6">
<h4><b>Color<span class="symbol "></span></b></h4>
<p>
<input class="form-control" type="text" name="color">
</p>
</div>
<div class="col-md-6">
<h4><b>Availability <span class="symbol required"></span></b></h4>
<select class="form-control" name="availability">
<option value="1">Available</option>
<option value="0">Not Available</option>
</select>
</div>
<div class="col-md-6">
<h4><b>Image <span class="symbol required"></span></b></h4>
<p>
<input class="form-control" accept="image/*" onchange="loadFile(event)" type="file" name="userfile" required multiple>
<img id="output" width="100px" height="100px" />
</p>
</div>
</div>
</div>
<div class="modal-footer">
<button type="reset" data-dismiss="modal" class="btn btn-light-grey">
Close
</button>
<button type="submit" class="btn btn-blue">
Add Product
</button>
</div>
</form>
</div>
</div>
</div>
<!-- End Modal -->
the modal will open properly and i can enter values.
But if use the modal for editing like below,
<a href="#edit<?php echo $product['list'][$row]->item_id; ?>" data-toggle="modal">
<button class="btn btn-blue"><i class="fa fa-pencil"></i> Edit </button>
</a>
<div id="edit<?php echo $product['list'][$row]->item_id?>" class="modal extended-modal fade no-display">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
×
</button>
<h4 class="modal-title" style="color:red">Edit Product</h4>
</div>
<div class="modal-body">
<div class="row">
<form action="<?php echo base_url() ?>admin/editProduct" enctype="multipart/form-data" method="post" autocomplete="off">
<div class="col-md-6">
<h4><b>Category Name <span class="symbol required"></span></b></h4>
<p>
<select class="form-control" name="cat_id" required>
<option value="">---- Select Category ----</option>
<?php
foreach($cat['list'] as $rows=>$value){ ?>
<option value="<?php echo $cat['list'][$rows]->cat_id; ?>"<?php if($cat['list'][$rows]->cat_id == $product['list'][$row]->cat_id) echo "selected=selected"; ?>><?php echo ucwords($cat['list'][$rows]->cat_name); ?></option>
<?php } ?>
</select>
</p>
</div>
<div class="col-md-6">
<input type="hidden" name="item_id" value="<?php echo $product['list'][$row]->item_id;?>">
<input type="hidden" name="image_name" value="<?php echo $product['list'][$row]->image;?>">
<h4><b>Product Name <span class="symbol required"></span></b></h4>
<p>
<input class="form-control" type="text" name="item_name" value="<?php echo $product['list'][$row]->item_name;?>" required>
</p>
</div>
<div class="col-md-6">
<h4><b>Small Description <span class="symbol required"></span></b></h4>
<p>
<input class="form-control" type="text" name="small_desc" value="<?php echo $product['list'][$row]->small_desc;?>">
</p>
</div>
<div class="col-md-6">
<h4><b>Quantity<span class="symbol required"></span></b></h4>
<p>
<input class="form-control" type="number" name="quantity" value="<?php echo $product['list'][$row]->quantity;?>" min="1" required>
</p>
</div>
<div class="col-md-6">
<h4><b>Customer Price<span class="symbol required"></span></b></h4>
<p>
<input class="form-control" type="text" name="price" value="<?php echo $product['list'][$row]->price;?>" min="1" required>
</p>
</div>
<div class="col-md-6">
<h4><b>Reseller Price<span class="symbol required"></span></b></h4>
<p>
<input class="form-control" type="text" name="reseller" value="<?php echo $product['list'][$row]->reseller;?>" min="1" required>
</p>
</div>
<div class="col-md-6">
<h4><b>Color<span class="symbol"></span></b></h4>
<p>
<input class="form-control" type="text" name="color" value="<?php echo $product['list'][$row]->color;?>">
</p>
</div>
<div class="col-md-6">
<h4><b>Availability <span class="symbol required"></span></b></h4>
<select class="form-control" name="availability">
<?php if($product['list'][$row]->availability==1){;?>
<option value="1" selected>Available</option>
<option value="0">Not Available</option>
<?php } else {?>
<option value="1">Available</option>
<option value="0" selected>Not Available</option>
<?php }?>
</select>
</div>
<div class="col-md-6">
<h4><b>Status <span class="symbol required"></span></b></h4>
<select class="form-control" name="status">
<?php if($product['list'][$row]->status==0){;?>
<option value="0" selected>Inactive</option>
<option value="1">Active</option>
<?php } else {?>
<option value="0">Inactive</option>
<option value="1" selected>Active</option>
<?php }?>
</select>
</div>
<div class="col-md-6">
<h4><b>Image <span class=""></span>
</b></h4>
<input class="form-control" type="file" name="userfile">
<img src="<?php echo base_url()." assets/uploads/ ".$product['list'][$row]->image;?>" height="50px" width="50px" border="1px solid #FFF">
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" data-dismiss="modal" class="btn btn-light-grey">
Close
</button>
<button type="submit" class="btn btn-blue">
Update
</button>
</div>
</form>
</div>
</div>
</div>
With dynamic id, the modal will open with light black overlay on it. I can't edit the fields. Nothing is working inside the modal.
I am Not Understanding What is the problem with dynamic modal.
If Anyone knows Please reply.
You can try two things. 1. Move your form tag out and place it like this -
<form action="./admin/editProduct" enctype="multipart/form-data" method="post" autocomplete="off">
<div class="modal-body">
Give your modal z-index of 999 or so using css like this -
<style>
.modal {
z-index: 999;
}
</style>

create a shortcode of html form

I am trying to create a short code for html form. because I want to use this multiple time in my word-press page.
I have no idea how to do this . if any help please let help me
<form action="<?php echo get_page_link(2599) ?>" method="POST" >
<input type='hidden' name='page_id' value='2599'>
<div class="row">
<div class="form-group col-sm-3 col-md-2" id="bgform_text2">
<h4>SEARCH</h4>
<p>For Your Favourite Place</p>
</div>
<div class="form-group col-sm-5 col-md-2">
<label>Where to ? </label>
<input type="text" name="names" class="input-text full-width" placeholder="start typing here....">
</div>
<div class="form-group col-sm-5 col-md-4">
<div class="row">
<div class="col-xs-6">
<label>Arrive </label>
<div class="controls">
<input type="text" name="arive_time" id="departing">
</div>
</div>
<div class="col-xs-6">
<label>Departs </label>
<div class="controls">
<input type="text" name="depart_time" id="returning">
</div>
</div>
</div>
</div>
<div class="form-group col-sm-9 col-md-2">
<label>Sleeps </label>
<div class="controls">
<i class="fa fa-sort"></i>
<select name="sleeps">
<option value="" disabled="" selected=""></option>
<option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option></option>
</select>
</div>
</div>
<div class="form-group col-sm-3 col-md-2">
<input type="submit" value="submit" name="submit_btn" class="button">
</div>
</div>
</form>
Try this.
<?php
function my_shortcode(){
$pagelink = get_page_link(2599);
return '<form action="'.$pagelink.'" method="POST" >
<input type="hidden" name="page_id" value="2599">
<div class="row">
<div class="form-group col-sm-3 col-md-2" id="bgform_text2">
<h4>SEARCH</h4>
<p>For Your Favourite Place</p>
</div>
<div class="form-group col-sm-5 col-md-2">
<label>Where to ? </label>
<input type="text" name="names" class="input-text full-width" placeholder="start typing here....">
</div>
<div class="form-group col-sm-5 col-md-4">
<div class="row">
<div class="col-xs-6">
<label>Arrive </label>
<div class="controls">
<input type="text" name="arive_time" id="departing">
</div>
</div>
<div class="col-xs-6">
<label>Departs </label>
<div class="controls">
<input type="text" name="depart_time" id="returning">
</div>
</div>
</div>
</div>
<div class="form-group col-sm-9 col-md-2">
<label>Sleeps </label>
<div class="controls">
<i class="fa fa-sort"></i>
<select name="sleeps">
<option value="" disabled="" selected=""></option>
<option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option></option>
</select>
</div>
</div>
<div class="form-group col-sm-3 col-md-2">
<input type="submit" value="submit" name="submit_btn" class="button">
</div>
</div>
</form>';
}
add_shortcode('my_shortcode_name','my_shortcode');
?>
you can use this shortcode in your page
<?php echo do_shortcode('[my_shortcode_name]');?>
I think you are saying that you do not want to copy-paste the exact same code on multiple places inside your project, PHP has an include control structure method to take any file and use the contents on run-time.
Your code could eventually look something like this:
# form definition inside the main page that needs the form
<form action="<?php echo get_page_link(2599) ?>" method="POST" >
# include the template
<?php include('template.php') ?>
</form>
# template.php contains the html form
<input type='hidden' name='page_id' value='2599'>

What's wrong with my button?

`<div class="tab-content">
<div class="row">
<div class="col-lg-6">
<form method="post" data-toggle="modal" enctype="multipart/form-data" action="data/pegawai/proses.php">
<div class="form-group">
<label>NIP</label>
<input class="form-control" name="nip" type="text" value="<?php echo $r['nip'];?>" readonly="">
</div>
<div class="form-group">
<label>Nama Lengkap</label>
<input class="form-control" type="text" value="<?php echo $r['nm_pegawai'];?>" name="nama" placeholder="Nama Lengkap" autofocus="" required="">
</div>
<div class="form-group">
<label>Jenis Kelamin</label>
<div class="radio">
<label class="radio-inline">
<input type="radio" name="jk" id="optionsRadiosInline1" value="Laki-laki" <?php $ob->cek("Laki-laki",$r['jenis_kelamin'],"radio") ?>>Laki-laki
</label>
<label class="radio-inline">
<input type="radio" name="jk" id="optionsRadiosInline2" value="perempuan" <?php $ob->cek("Perempuan",$r['jenis_kelamin'],"radio") ?>>perempuan
</label>
</div>
</div>
<div class="form-group">
<label>Tempat Lahir</label>
<input class="form-control" type="text" value="<?php echo $r['tempat_lahir'];?>" name="tmp_lahir" placeholder="Tempat Lahir" required="">
</div>
<div class="form-group">
<label>Tanggal Lahir</label>
<input type="date" name="tgl_lahir" value="<?php echo $r['tanggal_lahir'];?>" class="form-control" placeholder="Tanggal Lahir" required="">
</div>
<div class="form-group">
<label>Agama</label>
<select class="form-control" name="agama" required="">
<option <?php $ob->cek("Islam",$r['agama'],"select") ?> value="Islam">Islam</option>
<option <?php $ob->cek("Kristen",$r['agama'],"select") ?> value="Kristen">Kristen</option>
<option <?php $ob->cek("Katholik",$r['agama'],"select") ?> value="Katholik">Katholik</option>
<option <?php $ob->cek("Protestan",$r['agama'],"select") ?> value="Protestan">Protestan</option>
<option <?php $ob->cek("Hindu",$r['agama'],"select") ?> value="Hindu">Hindu</option>
<option <?php $ob->cek("Budha",$r['agama'],"select") ?> value="Budha">Budha</option>
</select>
</div>
<div class="form-group">
<label>Alamat</label>
<textarea class="form-control" name="alamat" rows="3" placeholder="Alamat Lengkap" required=""><?php echo $r['alamat'];?></textarea>
</div>
</div>
<div class="col-lg-6">
<div class="form-group">
<label>Nomor Telepon</label>
<input class="form-control" type="text" value="<?php echo $r['no_telp'];?>" name="telp" onkeypress="return isNumberKey(event)" maxlength="15" placeholder="Nomor telepon" required="">
</div>
<div class="form-group">
<label>Tahun Masuk</label>
<input class="form-control" type="text" value="<?php echo $r['tahun_masuk'];?>" name="thn_masuk" placeholder="Tahun Masuk" onkeypress="return isNumberKey(event)" maxlength="4" required="">
</div>
<div class="form-group">
<label>Bagian</label>
<select class="form-control" name="bagian" required="">
<option <?php $ob->cek("Teller",$r['bagian'],"select") ?> value="Teller">Teller</option>
<option <?php $ob->cek("CSO",$r['bagian'],"select") ?> value="CSO">CSO</option>
<option <?php $ob->cek("BO",$r['bagian'],"select") ?> value="BO">BO</option>
</select>
</div>
<div class="form-group">
<label>Cabang</label>
<?php
echo '<select class="form-control" name="cabang" required="">';
$query=mysql_query("
SELECT *
FROM bank");
while($entry1=mysql_fetch_array($query))
{
echo "<option";
if($entry1['kd_bank']==$r['kd_bank']){echo " selected=selected";}
echo " value='".$entry1['kd_bank']."'>" . $entry1['nm_bank'] . "</option>";
}
echo "</select>";
?>
</div>
<div class="form-group">
<label>Kata Sandi</label>
<input class="form-control" type="password" value="<?php echo $r['password']?>" name="password" placeholder="Kata Sandi">
</div>
</div>
<!-- /.col-lg-6 (nested) -->
</div>
<!-- /.row (nested) -->
<div class="modal-footer">
<button type="button" name="ubah" class="btn btn-primary">Ubah</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</form>
</div> `
my source code, my button cannot active, how to solving it?
Thank you
Pandhu
Make your button type as "submit" like below.
<button type="submit" name="ubah" class="btn btn-primary">Ubah</button>
Else you can also keep it as button, but in that case u need to use ajax(javascript) and onclick event on button , for example :
<button type="button" name="ubah" class="btn btn-primary" onclick="save()">Ubah</button>
where save() is some function in javascript that you will create to save the form data.

Laravel testing unreachable field error when there is two forms in page

I want to test a page which has two forms in.
When I want to test one of my forms the following error occurs:
Unreachable field "count"
Which count is a field in that form (it doesn't exit in the other form). When i remove the other form completely, it works correctly but I need to have both in the page.
It's my view:
<section class="content">
<div class="row">
<div class="col-md-6">
<div class="panel panel-green">
<div class="panel-heading">
<h3 class="panel-title">
Passenger Credit Adjustment
</h3>
</div>
<div class="panel-body">
<form method="post" action="{{route('credits.passenger.post', ['id' => $passenger->id])}}">
{{csrf_field()}}
<div class="form-group">
<label for="amount">Name</label>
<input type="text" class="form-control" id="name" name="name" disabled="disabled"
title="" value="{{$passenger->fullname}}">
</div>
<div class="form-group">
<label for="amount">Credit</label>
<input type="text" class="form-control" id="cashable" name="name" title=""
disabled="disabled" value="{{number_format($credit) . ' RLS'}}">
</div>
<div class="form-group">
<label for="amount">Add/DeductAmount</label>
<input type="text" class="form-control" id="amount" name="amount">
</div>
<div class="form-group">
<label for="description">Description</label>
<input type="text" class="form-control" id="description" name="description">
</div>
<button type="submit" class="btn btn-danger">Apply</button>
</form>
</div>
<div class="panel-heading">
<h3 class="panel-title">
<i class="livicon" data-name="money" data-loop="true" data-color="#fff"
data-hovercolor="#fff" data-size="18"></i>
Voucher
</h3>
</div>
<div class="panel-body">
<form method="post"
action="{{route('credits.rideVoucher.post', ['id' => $passenger->id])}}">
{{csrf_field()}}
<div class="form-group">
<label for="type">Type</label>
<select id="single-prepend-text" class="form-control select2" title=""
name="type">
<option value="5k">5k</option>
<option value="10k">10k</option>
<option value="20k">20k</option>
<option value="15p">15%</option>
<option value="20p">20%</option>
<option value="25p">25%</option>
<option value="30p">30%</option>
<option value="50p">50% (Max 10k)</option>
<option value="100p">100% (Max 20k)</option>
</select>
</div>
<button type="submit" class="btn btn-danger" name="generate">Generate</button>
</form>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-green">
<div class="panel-heading">
<h3 class="panel-title">
Free Ride
</h3>
</div>
<div class="panel-body">
<form method="post"
action="{{route('credits.passenger.freeRide.post', ['id' => $passenger->id])}}">
{{csrf_field()}}
<div class="form-group">
<label>Number of free ride(s):</label>
<input type="number" name="count" value="1" title="Count" id="count"
class="form-control">
</div>
<div class="form-group">
<label>Cap:</label>
<select class="form-control" name="cap" title="">
<option value="">[NOT SELECTED]</option>
<option value="50000">5,000 T</option>
<option value="100000">10,000 T</option>
<option value="150000">15,000 T</option>
<option value="200000">20,000 T</option>
</select>
</div>
<input type="submit" class="btn btn-danger" name="generate" value="Generate">
</form>
</div>
</div>
</div>
</div>
It's my test:
$this->visit($uri)
->type(3, 'count')
->select($cap, 'cap')
->press('Generate')
I'm using Laravel 5.1.
Both submit buttons have the same name. Try using different names. Also, instead of using press, you can use the submitForm method

Categories