so I have this problem.
I need to put second table next (right) to the first table. Or more like to put it like 10px next to it but have the top of the tables on the same 'y' px; Also I dont the tables to be solid, because tables are in for() and there should be more tables then just two (now it is 1+1, then 1+1 and under it anoter 1+1 tables) Now the second table is under the first one.
I tried few things but still i can't figure out the right answer. I am not css master, i'm just learning. Can anybody help?
<div style="width: 400px">
#foreach ($reminders as $reminder)
<table style="margin-left: 550px; width: 100%; position: center; margin-top: 50px;">
<tr style="">
<th colspan="4">{{$reminder->title}}</th>
</tr>
<tr>
<th colspan="4" style="height: 150px; text-align: left">{{$reminder->text}}</th></tr>
<tr>
<th>
<form method="post" action="/donereminder" >
#csrf
<input type="hidden" name="rem" value="{{$reminder->id}}" readonly style="width: 0%">
<button type="submit" style="width: 100%">Done</button>
</form></a></th>
<th><button class="button" style="width: 100%">Report</button></th>
<th><button class="button" style="width: 100%">Edit</button></th>
<th>
<form method="POST" action="/reminders/{{ $reminder->id}}">
#method('DELETE')
#csrf
<div class="field">
<div class="control">
<button type="submit" class="button" style="width: 100%;">🗑 </button>
</div>
</div>
</form>
</th></tr>
</table>
<table style="margin-left: 550px; width: 100%; position: center; margin-top: 50px">
<form method="POST" action="/reminders/{{$reminder->id}}">
#method('PATCH')
#csrf
<tr>
<th>
<div class="form-group">
<label>Name</label>
<input type="text" class="form-control" name="title" placeholder="Name of reminder" value="{{$reminder->title}}">
</div>
</th>
</tr>
<tr>
<th>
<div class="form-group">
<label>Text</label>
<input type="text" class="form-control" name="text" placeholder="Description of your reminder" value="{{$reminder->text}}">
</div>
</th>
</tr>
<tr>
<th> <div class="form-group">
<label>Typ</label>
<select class="form-control" name="typ" value="{{$reminder->typ}}">
<option name="typ" value="0">Práce</option>
<option name="typ" value="1">Narozeniny</option>
<option name="typ" value="2">Sport</option>
<option name="typ" value="3">Jiné</option>\
</select>
</div></th>
</tr>
<tr>
<th> <div class="form-group">
<label>Priorita</label>
<select class="form-control" name="priority" value="{{$reminder->priority}}">
<option name="priority" value="{{$reminder->priority}}">{{$reminder->priority}}</option>
<option name="priority" value="10">10</option>
<option name="priority" value="9">9</option>
<option name="priority" value="8">8</option>
<option name="priority" value="7">7</option>
<option name="priority" value="6">6</option>
<option name="priority" value="5">5</option>
<option name="priority" value="4">4</option>
<option name="priority" value="3">3</option>
<option name="priority" value="2">2</option>
<option name="priority" value="1">1</option>
</select>
</div></th>
</tr>
<tr>
<th>
<div class="form-group">
<label>Done time</label>
<input class="datepicker" data-date-format="mm/dd/yyyy" type="date" placeholder="MM/DD/YYYY" name="donetime" value="{{$reminder->donetime}}">
</div>
</th>
</tr>
<tr>
<th>
<div class="field">
<div class="control">
<button type="submit" class="button is-link" style="width: 25%;">Upravit reminder</button>
</div>
</div>
</th>
</tr>
</table>
</form>
There are many ways to do that. I suggest you this one for example.
Considerations:
Use display:inline-block in the child elements. This way, all the elements will go at the same "horizontal line".
vertical-align is set by default as baseline.So set vertical-align: top to avoid this.
The number of tables that fit will depend on their width and the width of their parent.
You can adjust margin-right on each table for the distance between them.
Notice that I deleted your php code and added background to the tables
due to show the result properly.
<div>
<table style="display:inline-block;vertical-align:top;margin-right: 10px;background-color:lightgreen;">
<tr style="">
<th colspan="4">{{$reminder->title}}</th>
</tr>
<tr>
<th colspan="4" style="height: 150px; text-align: left">{{$reminder->text}}</th></tr>
<tr>
<th>
<form method="post" action="/donereminder" >
#csrf
<input type="hidden" name="rem" value="{{$reminder->id}}" readonly style="width: 0%">
<button type="submit" style="width: 100%">Done</button>
</form></a></th>
<th><button class="button" style="width: 100%">Report</button></th>
<th><button class="button" style="width: 100%">Edit</button></th>
<th>
<form method="POST" action="/reminders/{{ $reminder->id}}">
<div class="field">
<div class="control">
<button type="submit" class="button" style="width: 100%;">🗑 </button>
</div>
</div>
</form>
</th></tr>
</table>
<table style="display:inline-block;vertical-align:top;background-color:lightgray;">
<form method="POST" action="/reminders/{{$reminder->id}}">
<tr>
<th>
<div class="form-group">
<label>Name</label>
<input type="text" class="form-control" name="title" placeholder="Name of reminder" value="{{$reminder->title}}">
</div>
</th>
</tr>
<tr>
<th>
<div class="form-group">
<label>Text</label>
<input type="text" class="form-control" name="text" placeholder="Description of your reminder" value="{{$reminder->text}}">
</div>
</th>
</tr>
<tr>
<th> <div class="form-group">
<label>Typ</label>
<select class="form-control" name="typ" value="{{$reminder->typ}}">
<option name="typ" value="0">Práce</option>
<option name="typ" value="1">Narozeniny</option>
<option name="typ" value="2">Sport</option>
<option name="typ" value="3">Jiné</option>\
</select>
</div></th>
</tr>
<tr>
<th> <div class="form-group">
<label>Priorita</label>
<select class="form-control" name="priority" value="{{$reminder->priority}}">
<option name="priority" value="{{$reminder->priority}}">{{$reminder->priority}}</option>
<option name="priority" value="10">10</option>
<option name="priority" value="9">9</option>
<option name="priority" value="8">8</option>
<option name="priority" value="7">7</option>
<option name="priority" value="6">6</option>
<option name="priority" value="5">5</option>
<option name="priority" value="4">4</option>
<option name="priority" value="3">3</option>
<option name="priority" value="2">2</option>
<option name="priority" value="1">1</option>
</select>
</div></th>
</tr>
<tr>
<th>
<div class="form-group">
<label>Done time</label>
<input class="datepicker" data-date-format="mm/dd/yyyy" type="date" placeholder="MM/DD/YYYY" name="donetime" value="{{$reminder->donetime}}">
</div>
</th>
</tr>
<tr>
<th>
<div class="field">
<div class="control">
<button type="submit" class="button is-link" style="width: 25%;">Upravit reminder</button>
</div>
</div>
</th>
</tr>
</table>
</form>
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I have a table with form input inside it. Whenever I click the submit button, it will save all of the data into the database like this.
What should I do inside my Laravel Controller? Thanks in advance. Here's my code example
UPDATE
Result:
UPDATE
HTML Form Input:
<form action="/test-submit" method="post">
#csrf
<table id="example2" class="presence-table table table-bordered table-hover">
<thead>
<tr>
<th class="align-middle" rowspan="2">#</th>
<th class="align-middle" rowspan="2">Name</th>
<th class="align-middle" colspan="6">Date</th>
</tr>
<tr>
<th class="align-middle">1 Jan</th>
<th class="align-middle">2 Jan</th>
<th class="align-middle">3 Jan</th>
<th class="align-middle">4 Jan</th>
<th class="align-middle">5 Jan</th>
<th class="align-middle">6 Jan</th>
</tr>
</thead>
<tbody>
#php
$employees=["Gunawan","Roy"];
$dates = ["1 Jan", "2 Jan", "3 Jan", "4 Jan", "5 Jan", "6 Jan"];
#endphp
#foreach($employees as $key=>$value)
<tr class="data-row">
<td class="align-middle iteration"></td>
<input type="hidden" name="row[{{$key}}][employee_name]" value="{{$value}}">
<td>{{ $value }}</td>
#foreach ($dates as $date)
<td>
<div class="form-group">
<select class="form-control" name="row[{{$key}}][presence][{{ $loop->iteration }}][presenceType]" required>
<option value="">-- Select --</option>
<option value="1">Full</option>
<option value="0.5">Half</option>
<option value="0">Zero</option>
</select>
</div>
</td>
<input type="hidden" name="row[{{$key}}][presence][{{ $loop->iteration }}][presencedate]" value="{{ $date }}">
#endforeach
</tr>
#endforeach
</tbody>
</table>
<button type="submit" class="float-right btn btn-info">Save</button>
</form>
UPDATE
Controller:
$data= collect($request->row)->map(function ($row,$key)use($request){
return collect($row['presence'])->map(function ($presence)use($row){
return ['name'=>$row['employee_name'],'value'=>$presence['presenceType'],'date'=>$presence['presencedate']];
});
})->flatten(1)->toArray();
dd($data);
Not sure from where date will get but for other data first change form design
<form action="{{route("test")}}" method="post">
#csrf
<table id="example2" class="presence-table table table-bordered table-hover">
<thead>
<tr>
<th class="align-middle" rowspan="2">#</th>
<th class="align-middle" rowspan="2">Name</th>
<th class="align-middle" colspan="6">Date</th>
</tr>
<tr>
<th class="align-middle">1 Jan</th>
<th class="align-middle">2 Jan</th>
<th class="align-middle">3 Jan</th>
<th class="align-middle">4 Jan</th>
<th class="align-middle">5 Jan</th>
<th class="align-middle">6 Jan</th>
</tr>
</thead>
<tbody>
#php
$employee=["Gunawan","Roy"];
#endphp
#foreach($employee as $key=>$value)
<tr class="data-row">
<td class="align-middle iteration"></td>
<input type="hidden" name="row[{{$key}}][employee_name]" value="{{$value}}">
<td>Gunawan</td>
<td>
<div class="form-group">
<select class="form-control" name="row[{{$key}}][presence][1]" required>
<option value="">-- Select --</option>
<option value="1">Full</option>
<option value="0.5">Half</option>
<option value="0">Zero</option>
</select>
</div>
</td>
<td>
<div class="form-group">
<select class="form-control" name="row[{{$key}}][presence][2]" required>
<option value="">-- Select --</option>
<option value="1">Full</option>
<option value="0.5">Half</option>
<option value="0">Zero</option>
</select>
</div>
</td>
<td>
<div class="form-group">
<select class="form-control" name="row[{{$key}}][presence][3]" required>
<option value="">-- Select --</option>
<option value="1">Full</option>
<option value="0.5">Half</option>
<option value="0">Zero</option>
</select>
</div>
</td>
<td>
<div class="form-group">
<select class="form-control" name="row[{{$key}}][presence][4]" required>
<option value="">-- Select --</option>
<option value="1">Full</option>
<option value="0.5">Half</option>
<option value="0">Zero</option>
</select>
</div>
</td>
<td>
<div class="form-group">
<select class="form-control" name="row[{{$key}}][presence][5]" required>
<option value="">-- Select --</option>
<option value="1">Full</option>
<option value="0.5">Half</option>
<option value="0">Zero</option>
</select>
</div>
</td>
<td>
<div class="form-group">
<select class="form-control" name="row[{{$key}}][presence][6]" required>
<option value="">-- Select --</option>
<option value="1">Full</option>
<option value="0.5">Half</option>
<option value="0">Zero</option>
</select>
</div>
</td>
</tr>
#endforeach
</tbody>
</table>
<button type="submit" class="float-right btn btn-info">Save</button>
</form>
and in controller
$data= collect($request->row)->map(function ($row,$key)use($request){
return collect($row['presence'])->map(function ($presence)use($row){
return ['name'=>$row['employee_name'],'value'=>$presence];
});
})->flatten(1)->toArray();
and for insert to database
ModelName::insert($data);
Updated
You can do somethink like below for each date
<td>
<div class="form-group">
<select class="form-control" name="row[{{$key}}][presence][1]['presenceType']" required>
<option value="">-- Select --</option>
<option value="1">Full</option>
<option value="0.5">Half</option>
<option value="0">Zero</option>
</select>
</div>
</td>
<td>
<div class="form-group">
<input type="text" name="row[{{$key}}][presence][1]['presencedate']" value="">
</div>
</td>
and in controller
return ['name'=>$row['employee_name'],'value'=>$presence['presenceType'],'dae'=>$presence['presencedate']];
Update2
<form action="{{route("test")}}" method="post">
#csrf
<table id="example2" class="presence-table table table-bordered table-hover">
<thead>
<tr>
<th class="align-middle" rowspan="2">#</th>
<th class="align-middle" rowspan="2">Name</th>
<th class="align-middle" colspan="6">Date</th>
</tr>
<tr>
<th class="align-middle">1 Jan</th>
<th class="align-middle">date</th>
<th class="align-middle">2 Jan</th>
<th class="align-middle">3 Jan</th>
<th class="align-middle">4 Jan</th>
<th class="align-middle">5 Jan</th>
<th class="align-middle">6 Jan</th>
</tr>
</thead>
<tbody>
#php
$employee=["Gunawan","Roy"];
$dates = ["1 Jan", "2 Jan", "3 Jan", "4 Jan", "5 Jan", "6 Jan"];
#endphp
#foreach($employee as $key=>$value)
<tr class="data-row">
<td class="align-middle iteration"></td>
<input type="hidden" name="row[{{$key}}][employee_name]" value="{{$value}}">
<td>Gunawan</td>
<td>
<div class="form-group">
<select class="form-control" name="row[{{$key}}][presence][1][presenceValue]" required>
<option value="">-- Select --</option>
<option value="1">Full</option>
<option value="0.5">Half</option>
<option value="0">Zero</option>
</select>
</div>
</td>
<td>
<div class="form-group">
<select class="form-control" name="row[{{$key}}][presence][1][presenceDate]" required>
<option value="">-- Select --</option>
#foreach($dates as $date)
<option value="{{$date}}">{{$date}}</option>
#endforeach
</select>
</div>
</td>
<td>
<div class="form-group">
<select class="form-control" name="row[{{$key}}][presence][2][presenceValue]" required>
<option value="">-- Select --</option>
<option value="1">Full</option>
<option value="0.5">Half</option>
<option value="0">Zero</option>
</select>
</div>
</td>
<td>
<div class="form-group">
<select class="form-control" name="row[{{$key}}][presence][2][presenceDate]" required>
<option value="">-- Select --</option>
#foreach($dates as $date)
<option value="{{$date}}">{{$date}}</option>
#endforeach
</select>
</div>
</td>
<td>
<div class="form-group">
<select class="form-control" name="row[{{$key}}][presence][3][presenceValue]" required>
<option value="">-- Select --</option>
<option value="1">Full</option>
<option value="0.5">Half</option>
<option value="0">Zero</option>
</select>
</div>
</td>
<td>
<div class="form-group">
<select class="form-control" name="row[{{$key}}][presence][3][presenceDate]" required>
<option value="">-- Select --</option>
#foreach($dates as $date)
<option value="{{$date}}">{{$date}}</option>
#endforeach
</select>
</div>
</td>
<td>
<div class="form-group">
<select class="form-control" name="row[{{$key}}][presence][4][presenceValue]" required>
<option value="">-- Select --</option>
<option value="1">Full</option>
<option value="0.5">Half</option>
<option value="0">Zero</option>
</select>
</div>
</td>
<td>
<div class="form-group">
<select class="form-control" name="row[{{$key}}][presence][4][presenceDate]" required>
<option value="">-- Select --</option>
#foreach($dates as $date)
<option value="{{$date}}">{{$date}}</option>
#endforeach
</select>
</div>
</td>
<td>
<div class="form-group">
<select class="form-control" name="row[{{$key}}][presence][5][presenceValue]" required>
<option value="">-- Select --</option>
<option value="1">Full</option>
<option value="0.5">Half</option>
<option value="0">Zero</option>
</select>
</div>
</td>
<td>
<div class="form-group">
<select class="form-control" name="row[{{$key}}][presence][5][presenceDate]" required>
<option value="">-- Select --</option>
#foreach($dates as $date)
<option value="{{$date}}">{{$date}}</option>
#endforeach
</select>
</div>
</td>
<td>
<div class="form-group">
<select class="form-control" name="row[{{$key}}][presence][6][presenceValue]" required>
<option value="">-- Select --</option>
<option value="1">Full</option>
<option value="0.5">Half</option>
<option value="0">Zero</option>
</select>
</div>
</td>
<td>
<div class="form-group">
<select class="form-control" name="row[{{$key}}][presence][6][presenceDate]" required>
<option value="">-- Select --</option>
#foreach($dates as $date)
<option value="{{$date}}">{{$date}}</option>
#endforeach
</select>
</div>
</td>
</tr>
#endforeach
</tbody>
</table>
<button type="submit" class="float-right btn btn-info">Save</button>
</form>
and in controller
$data= collect($request->row)->map(function ($row,$key)use($request){
return collect($row['presence'])->map(function ($presence)use($row){
return ['name'=>$row['employee_name'],'value'=>$presence['presenceValue'],'date'=>$presence['presenceDate']];
});
})->flatten(1)->toArray();
dd($data);
How to make auto scroll to Top after submit error and when it scroll up need to be smooth but not straight to the top and when it scroll to the top it need to have like 100px space gap from the header .
This is the code that I try to used but it doesn't seems to work in my code
This is the jquery I have tried :-
$("#submit").click( function() {
$(window).scrollTop(100);
});
And I have tried to insert this in the CSS :-
scroll-behaviour: smooth;
Sometimes it work but sometimes it can't work. But when I insert the scroll behavior the text field required error message doesn't appear.
And this is my php file code :-
<!DOCTYPE HTML>
<html>
<head>
<title>Create New Explore</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Montserrat">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="//code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="js/script.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="css/desaru.css" type="text/css">
<link rel="stylesheet" href="css/header.css" type="text/css">
<link rel="stylesheet" href="css/style.css" type="text/css">
<link rel="stylesheet" href="css/footer.css" type="text/css">
</head>
<body>
<br/>
<script src="js/script.js"></script>
<?php include('header.html'); ?>
<br/><br/><br/><br/>
<div id="scrollbox">
<!-- Content Section -->
<div class="container">
<div class="row">
<div class="col-md-12">
<h1><strong>Create New Explore</strong></h1>
</div>
</div>
<br/><br/>
<script>
$(document).ready(function() { // website fully loaded
$('#submit').click(function() { //if button id=submit click trigger function down
var name = $('#foldername').val(); //retrieve input for folder name
var httpvar = 'http://211.25.118.147';
var defaultfolder = '/resource/';
//alert(name); get retrieve test name
if(name==""){ // if foldername input blank
alert("Insert folder name");
}
else {
$.ajax( {
url : "addfolder.php",
type: "POST",
data: {foldername : name}, //pass input foldername = name(variable declare at the top) foldername name base on html that set
success: function(result){ //if success will sent the post data
//alert(result);
if (result=="success") { //based on output echo addfolder.php
alert("File "+name+" has been added");
$("#SelectImageFolder option[value='.."+defaultfolder+name+"']").remove();
$("#SelectImageFolder").append($('<option>', { //add new options
value : ".."+defaultfolder+name ,
text : httpvar+defaultfolder+name
}))
$("#SelectImageFolder option:last").attr("selected", "selected");//auto select the last option
}
else if(result=="fail") {// if the file exist then result will fail to create the file
alert("Something wrong happened");
}
}
}
)
}
})
});
</script>
<form id="createexplore" action="CreateExploreProcess.php" method="post" enctype="multipart/form-data" >
<table class='table table-hover table-responsive table-bordered'>
<!--<tr>
<td>Class</td>
<td colspan="2">
<input type='text' name='Class' readonly class='form-control' value='Explore' maxlength="20"/>
</td>
</tr>-->
<!--<tr>
<td>Placemark</td>
<td colspan="2">
<Input type='number' name="Placemark" class='form-control' >
</td>
</tr>-->
<tr>
<td>Category</td>
<td colspan="2">
<div class="custom-select" style="width:200px;">
<select required>
<option value="" selected disabled hidden>Select Category..</option>
<option value="Stay">Stay</option>
<option value="Dining">Dining</option>
<option value="Facilities">Facilities</option>
<option value="ThingstoDo">Things to Do</option>
<option value="NearbyAttractions">Nearby Attractions</option>
</select>
</div>
</td>
</tr>
<tr>
<td>Sub Category</td>
<td colspan="2">
<div class="custom-select" style="width:200px;">
<select required>
<option value="" selected disabled hidden>Select Sub Category... </option>
<option value="TheWestinDesaruCoastResort"> The Westin Desaru Coast Resort </option>
<option value="Kiosk"> Kiosk </option>
<option value="ShuttlePickupPoints"> Shuttle Pickup Points </option>
<option value="Rides&Attractions"> Rides & Attractions </option>
<option value="ParkingBay"> Parking Bay </option>
<option value="DesaruOstrichFarm"> Desaru Ostrich Farm </option>
<option value="Restroom"> Restroom </option>
<option value="Cafe"> Cafe </option>
<option value="AnataraCoastResort&Villas"> Anatara Coast Resort & Villas </option>
<option value="Kids"> Kids </option>
<option value="DesaruCrocodileFarm"> Desaru Crocodile Farm </option>
<option value="Restaurant"> Restaurant </option>
<option value="Riverside"> Riverside </option>
<option value="InformartionKiosk"> Informartion Kiosk </option>
<option value="Amphitheater"> Amphitheater </option>
<option value="MainAttractions"> Main Attractions </option>
<option value="DesaruCoastAdventureWaterPark"> Desaru Coast Adventure Water Park </option>
<option value="Golf"> Golf </option>
<option value="LuxuryResorts&Villas"> Luxury Resorts & Villas </option>
<option value="HardRockHotelDesaruCoast"> Hard Rock Hotel Desaru Coast </option>
<option value="ConferenceCentre"> Conference Centre </option>
<option value="Shopping"> Shopping </option>
<option value="Spas"> Spas </option>
<option value="BeachActivities"> Beach Activities </option>
<option value="DesaruFruitFarm"> Desaru Fruit Farm </option>
<option value="DisabledToilet"> Disabled Toilet </option>
<option value="FirstAid"> First Aid </option>
<option value="ChangingRoom"> Changing Room </option>
<option value="Locker"> Locker </option>
<option value="BabyChangingRoom"> Baby Changing Room </option>
<option value="LostandFound"> Lost and Found </option>
<option value="MuslimPrayerRoom"> Muslim Prayer Room </option>
</select>
</div>
</td>
</tr>
<tr>
<td>Item</td>
<td colspan="2">
<div class="custom-select" style="width:200px;">
<select required>
<option value="" selected disabled hidden>Select Item... </option>
<option value="Hotel"> Hotel </option>
<option value="Kiosks"> Kiosks </option>
<option value="ShuttlePickup"> Shuttle Pickup </option>
<option value="Rides&Attractions"> Rides & Attractions </option>
<option value="ParkingBay"> Parking Bay </option>
<option value="Sightseeing"> Sightseeing </option>
<option value="Restroom"> Restroom </option>
<option value="Cafe"> Cafe </option>
<option value="Kids"> Kids </option>
<option value="Restaurant"> Restaurant </option>
<option value="Riverside"> Riverside </option>
<option value="InformartionKiosks"> Informartion Kiosks </option>
<option value="Amphitheater"> Amphitheater </option>
<option value="MainAttractions"> Main Attractions </option>
<option value="DesaruCoastAdventureWaterPark"> Desaru Coast Adventure Water Park </option>
<option value="Golf"> Golf </option>
<option value="ConferenceCentre"> Conference Centre </option>
<option value="Shopping"> Shopping </option>
<option value="Spas"> Spas </option>
<option value="BeachActivities"> Beach Activities </option>
<option value="DisabledToilet"> Disabled Toilet </option>
<option value="FirstAid"> First Aid </option>
<option value="ChangingRoom"> Changing Room </option>
<option value="Locker"> Locker </option>
<option value="BabyChangingRoom"> Baby Changing Room </option>
<option value="LostandFound"> Lost and Found </option>
<option value="MuslimPrayerRoom"> Muslim Prayer Room </option>
</select></div>
</td>
</tr>
<tr>
<td>Title</td>
<td colspan="2">
<input type="text" required name='Title' class='form-control' maxlength="150"/>
</td>
</tr>
<tr>
<td>Details Header</td>
<td colspan="2">
<input type="text" required name="DetailsHeader" class='form-control' maxlength="200"/>
</td>
</tr>
<tr>
<td>Details</td>
<td colspan="2">
<textarea required name="Details" rows="8" class='form-control' maxlength="4000"></textarea>
</td>
</tr>
<tr>
<td>Button Promo</td>
<td colspan="2">
<Input required type="text" name="ButtonPromo" class='form-control' maxlength="20"/>
</td>
</tr>
<tr>
<td>Key Features</td>
<td colspan="2">
<Input required type="text" name="KeyFeatures" class='form-control' maxlength="20"/>
</td>
</tr>
<tr>
<td>Features</td>
<td colspan="2">
<textarea required name="FeaturesList" rows="5" class='form-control' maxlength="1000"></textarea>
</td>
</tr>
<tr>
<td>Image Folder</td>
<td colspan="2">
<select name="SelectImageFolder" id="SelectImageFolder" class='form-control'>
<option value="selected" selected="selected">Select a folder</option>
<?php
$dirs = glob("../resource/*", GLOB_ONLYDIR);
// create variable constant url
$httpvar = 'http://211.25.118.147';
foreach($dirs as $val){
$httpcon = str_replace("..",$httpvar,$val);
echo '<option value="'.$val.'">'.$httpcon."</option>\n";
}
?>
</select><br/>
<div class="input-group">
<input type="text" required name="foldername" id="foldername" placeholder="Folder Name" class='form-control' maxlength="100" />
<span class="input-group-btn">
<button type="button" name="submit" id="submit" class="btn"/>Add Folder</button>
</span>
</div></td>
<script="js/script.js">
</script>
</tr>
<tr>
<td>List Images</td>
<td colspan="2">
<input type="file" name="FileListImage" id="FileListImage">
</td>
</tr>
<tr>
<td>Carousel 1</td>
<td colspan="2">
<input required type="file" name="FileCarousel1" id="FileCarousel1">
</td>
</tr>
<tr>
<td>Carousel 2</td>
<td colspan="2">
<input type="file" name="FileCarousel2" id="FileCarousel2">
</td>
</tr>
<tr>
<td>Carousel 3</td>
<td colspan="2">
<input type="file" name="FileCarousel3" id="FileCarousel3">
</td>
</tr>
<tr>
<td>Carousel 4</td>
<td colspan="2">
<input type="file" name="FileCarousel4" id="FileCarousel4">
</td>
</tr>
<tr>
<td>Carousel 5</td>
<td colspan="2">
<input type="file" name="FileCarousel5" id="FileCarousel5">
</td>
</tr>
<tr>
<td>Carousel 6</td>
<td colspan="2">
<input type="file" name="FileCarousel6" id="FileCarousel6">
</td>
</tr>
<tr>
<td>Find On Map</td>
<td colspan="2">
<Input required type="text" name="FindOnMap" class='form-control' maxlength="100"/>
</td>
</tr>
<tr>
<td>Call To Book</td>
<td colspan="2">
<Input type="text" name="CallToBook" class='form-control' maxlength="100"/>
</td>
</tr>
<!--<tr>
<td>Find On Map Ico</td>
<td> <input type="url" name="FindOnMapIco" class='form-control' /> </td>
<td><input type="file" name="FileImage" id="FileImage"></td>
</tr>
<tr>
<td>Call To Book Ico</td>
<td> <input type="url" name="CallToBookIco" class='form-control' /></td>
<td><input type="file" name="FileImage" id="FileImage"></td>
</tr>-->
<tr>
<!--<td >Icon</td>
<td colspan="2">
<input type="url" name="Icon" class='form-control' maxlength="100"/>
</td>
</tr>-->
<tr>
<td>In Park</td>
<td colspan="2">
<div class="custom-select" style="width:200px;">
<select required>
<option value="" selected disabled hidden>Select... </option>
<option value="Yes"> Yes </option>
<option value="No"> No </option>
<option value=""> </option>
</select>
</div>
</td>
</tr>
<tr>
<td>Ticket Entry</td>
<td colspan="2">
<input type="text" name="TicketedEntry" class='form-control' maxlength="100"/>
</td>
</tr>
<tr>
<td>Operation Hours</td>
<td colspan="2">
<textarea name="OperationHours" rows="6" class='form-control'> </textarea>
</td>
</tr>
<tr>
<td>Ride Details</td>
<td colspan="2">
<textarea name="RideDetails" class='form-control' maxlength="255"/></textarea>
</td>
</tr>
<tr>
<td>Listing Details</td>
<td colspan="2">
<textarea name="ListingDetails" class='form-control' maxlength="255"/></textarea>
</td>
</tr>
<tr>
<!--<td>Favourites</td>
<td colspan="2">
<div class="custom-select" style="width:200px;">
<select>
<option value="" selected disabled hidden>Select... </option>
<option value="Yes"> Yes </option>
<option value=""> </option>
</select>
</div>
</td>
</tr>
<tr>
<td>FB Like</td>
<td colspan="2">
<div class="custom-select" style="width:200px;">
<select>
<option value="" selected disabled hidden>Select... </option>
<option value="Yes"> Yes </option>
<option value=""> </option>
</select>
</div>
</td>
</tr>-->
<tr>
<td>More Details</td>
<td colspan="2">
<input type="text" name="MoreDetails" class='form-control' maxlength="100"/>
</td>
</tr>
<tr>
<td>Distance </td>
<td colspan="2">
<input type="text" name="DistanceAway" class='form-control' maxlength="100"/>
</td>
</tr>
<tr>
<td>Status</td>
<td colspan="2">
<div class="custom-select" style="width:200px;">
<select required>
<option value="" selected disabled hidden>Status... </option>
<option value="Active"> Active </option>
<option value="Inactive"> Inactive </option>
</select>
</div>
</td>
</tr>
<tr>
<td>Zoom</td>
<td>
<input type="number" name="ZoomStart" class='form-control' placeholder="Start" min="14" max="19"/>
</td>
<td>
<input type="number" name="ZoomEnd" class='form-control' placeholder="End" min="14" max="19"/>
</td>
</td>
</tr>
<tr>
<td>GPS Coordinate</td>
<td>
<input type="text" id="Lat" name="Lat" class='form-control' placeholder="Latitude" maxlength="12"/>
</td>
<td>
<input type="text" id="Lng" name="numeric" class='form-control' placeholder="Longitude" maxlength="12"/>
</td>
</td>
<script src="js/script.js">
</script>
</tr>
<tr>
<td>Phone</td>
<td colspan="2">
<input required type="text" id="hpno" name="Phone" class='form-control' maxlength="12"/>
</td>
<script src="js/script.js">
</script>
</tr>
<tr>
<td></td>
<td colspan="2">
<input type='submit' id='submit' name='Add' value='Save' class='btn btn-warning'/>
<a href='Explore.php' class='btn btn-danger'>Back</a>
</td>
</tr>
<span id="error_message" class="text-danger"></span>
<span id="success_message" class="text-success"></span>
</table>
</form>
<!-- End Content Section -->
<?php include('footer.html'); ?>
</div> </div>
<script src="js/script.js"></script>
</body>
</html>
And CSS code:-
#scrollbox {
overflow-y:auto;
height: 478px;
width: 100%;
margin-top: -80px;
scroll-behaviour: smooth;
}
I can't for the life of me figure out why i keep coming up with 0 on this ... i'm pulling a price from one of my tables and multiplying it by the quantity they are putting in in the form ... for some reason it when i try and do the math, it keeps coming up as 0 ... any help?
code:
$get_code = "SELECT * FROM products WHERE p_code LIKE '%$po_code%'";
$run_code = mysqli_query($con, $get_code);
$row_code = mysqli_fetch_array($run_code);
$count = $_POST['ord_amt'];
$price = $row_code['p_price'];
$sum_total = $price * $count;
form code:
<form action="" method="post">
<?php
include('includes/connection.php');
global $con;
$cust = "SELECT * FROM users WHERE u_id = '".$_SESSION['u_id']."'";
$r_cs = mysqli_query($con, $cust);
$rw_c = mysqli_fetch_array($r_cs);
echo "<input type='hidden' name='c_id' value='".$rw_c['c_id']."'>";
?>
<table id="datatable1" class="table table-striped table-bordered" cellspacing="0" width="100%">
<thead>
<tr>
<th>Product</th>
<th>Distal Opening</th>
<th>Material</th>
<th>Ply</th>
<th>Size</th>
<th>Length</th>
<th>Options</th>
<th>Or Enter Code (If Known)</th>
<th>Amount</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<select class="form-control" name="prod" id="selectProd" onchange="get_prod(this.value)" required="required">
<?php get_prod_kind() ?>
</select>
</td>
<td>
<select class="form-control" name="opening" id="distOpen" required="required">
<option value="">Select Opening</option>
<option value="1">Rubberized Reinforced</option>
<option value="2">Standard Opening</option>
<option value="">None</option>
</select>
</td>
<td>
<select class="form-control" name='mat' id="selectMat" onchange="get_ply(this.value)" required="required">
</select>
</td>
<td>
<select class="form-control" name="ply" id="plySelect" onchange="get_size(this.value)" required="required">
<option value=""></option>
</select>
</td>
<td>
<select class="form-control" name="size" id="sizeSelect" onchange="get_len(this.value)" required="required">
<option value=""></option>
</select>
</td>
<td>
<select class="form-control" name="length" id="selectLength" required="required">
<option value=""></option>
</select>
</td>
<td>
<select class="form-control" name="opts" required="required">
<option value="">Select Options</option>
<option value="1">Sewn Top (S)</option>
<option value="2">Seal-In-Liner (C)</option>
<option value="">None</option>
</select>
</td>
<td><input class="form-control" type='text' name='cust_code'></td>
<td><input class="form-control" type='text' name='ord_amt' required="required"></td>
</tr>
</tbody>
</table>
<button class="button button-3d button-rounded button-aqua" name="p_order"><i class="icon-repeat"></i>Next Item</button>
<button class="button button-3d button-rounded button-green"><i class="icon-ok"></i>Submit Order</button>
</form>
This may be a duplicate question,
But still, I did not find the answer.
My requirement is :
How to get the table rows which are CHECKED.
Here is my issue's screenshot. enter image description here
My checkbox name is 'check[]'
and the name of the select box is 'class[]',
and the form is posted to process.php.
How to get the value of 'class[]' where the checked boxes are checked so that I can then process with PHP-MYSQL?
My code is here:
<div class="col-md-5">
<form action="process.php" method="post">
<table class="table" id="table">
<tr><th>Opt</th><th>Name</th><th>Next Class</th></tr>
<? $q = $sdb->where('ac_CurClass',4)->get('tbl_accounts');
foreach ($q as $r){ ?>
<tr>
<td><input type="checkbox" name="sel[]" class="checkbox small" value="<?=$r['ac_Id'];?>"></td>
<td><?=ac_details($r['ac_Id'])->ac_Name;?></td>
<td>
<select class="form-control small" name="class[]">
<? $c = $sdb->where('c_Id',ac_details($r['ac_Id'])->ac_CurClass,">")->get("tbl_classes");
foreach($c as $d) {?>
<option value="<?=$d['c_Id'];?>"><?=$d['c_Name'];?></option>
<? } ?></select>
</td>
</tr>
<? } ?>
</table>
<button type="submit" class="btn btn-danger">Update</button>
</form>
</div>
Hope this code is help full for you
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<div class="col-md-5">
<form action="#" method="post">
<table class="table" id="table">
<thead><tr><th>Opt</th><th>Name</th><th>Next Class</th></tr></thead>
<tbody id="cont">
<tr>
<td><input type="checkbox" name="sel[]" class="checkbox small" value="1"></td>
<td>asass</td>
<td>
<select class="form-control small" name="class[]">
<option value="">Select option</option>
<option value="A">A</option>
<option value="B">B</option>
<option value="C">C</option>
</select>
</td>
</tr>
<tr>
<td><input type="checkbox" name="sel[]" class="checkbox small" value="2"></td>
<td>asass</td>
<td>
<select class="form-control small" name="class[]">
<option value="">Select option</option>
<option value="A">A</option>
<option value="B">B</option>
<option value="C">C</option>
</select>
</td>
</tr>
<tr>
<td><input type="checkbox" name="sel[]" class="checkbox small" value="3"></td>
<td>asass</td>
<td>
<select class="form-control small" name="class[]">
<option value="">Select option</option>
<option value="A">A</option>
<option value="B">B</option>
<option value="C">C</option>
</select>
</td>
</tr>
</tbody>
</table>
<button type="button" class="btn btn-danger" id="submit">Update</button>
</form>
</div>
<script>
$(document).ready(function(){
$('#submit').click(function(){
$("#cont input:checkbox:checked").map(function(){
alert('Checkbox value - '+$(this).val()+' / Select Box value - '+$(this).parent().next().next('td').find('select').val());
//alert('Select Box value - '+$(this).parent().next().next('td').find('select').val());
});
});
});
</script>
After that you can pass a Ajax so that only checked rows post.
Try as follows
Post as form
<form action="process.php" method="post">
In process.php file
if($check[0]===true){
$nextclass1 = $_POST['list_box'];
}
if($check[1]===true){
$nextclass2= $_POST['list_box'];
}
I'm trying to generate a specific url from the form below.
There will be a calendar and the date will go into the url.
Also a value from 9 ticket types and quantities of each of those tickets.
So my url will look something like this
https://sales.site.com/?action=quicksale&venueid=1&businessdate=2012-10-05&ticketids=6,8&quantities=1,1
With these values:
action: always "quicksale",
venueid: always "1",
businessdate: the sales date requested; can be either mm-dd-yyyy or yyyy-mm-dd,
ticketids: see chart below,
quantities: in the order the ticketid's are listed.
How would I approach this, and should I use php or jquery? Post or Get.
Should the calendar be Jquery?
Looking for advice, thanks
<form method="post" action="">-->
<div class="quick-book-form-elements">
<table width="255" class="quick-book-table" cellpadding="4">
<tbody>
<tr class="quick-book-days">
<th> </th>
<th><img src="../public/img/1day-small.png" alt="" /></th>
<th><img src="../public/img/2day-small.png" alt="" /></th>
<th class="quick-book-last"><img src="../public/img/3day-small.png" alt="" /></th>
</tr>
<tr class="quick-book-adults">
<th class="quick-book-labels">
Adult
</th>
<td>
<div class="ticket-style-quick-book">
<select class="adult-ticket-select">
<option value="0">0</option>
<option value="1">1</option>
</select>
<span class="quick-book-price">$40/ea</span>
</div>
</td>
<td>
<div class="ticket-style-quick-book">
<select class="adult-ticket-select">
<option value="0">0</option>
<option value="1">1</option>
</select>
<span class="quick-book-price">$50/ea</span>
</div>
</td>
<td class="quick-book-last">
<div class="ticket-style-quick-book">
<select class="adult-ticket-select">
<option value="0">0</option>
<option value="1">1</option>
</select>
<span class="quick-book-price">$60/ea</span>
</div>
</td>
</tr>
<tr class="quick-book-child">
<th class="quick-book-labels">Child</th>
<td>
<div class="ticket-style-quick-book">
<select class="adult-ticket-select">
<option value="0">0</option>
<option value="1">1</option>
</select>
<span class="quick-book-price">$30/ea</span>
</div>
</td>
<td>
<div class="ticket-style-quick-book">
<select class="adult-ticket-select">
<option value="0">0</option>
<option value="1">1</option>
</select>
<span class="quick-book-price">$40/ea</span>
</div>
</td>
<td class="quick-book-last">
<div class="ticket-style-quick-book">
<select class="adult-ticket-select">
<option value="0">0</option>
<option value="1">1</option>
</select>
<span class="quick-book-price">$50/ea</span>
</div>
</td>
</tr>
<tr class="quick-book-family">
<th class="quick-book-labels">Family</th>
<td>
<div class="ticket-style-quick-book">
<select class="adult-ticket-select">
<option value="0">0</option>
<option value="1">1</option>
</select>
<span class="quick-book-price">$125/ea</span>
</div>
</td>
<td>
<div class="ticket-style-quick-book">
<select class="adult-ticket-select">
<option value="0">0</option>
<option value="1">1</option>
</select>
<span class="quick-book-price">$155/ea</span>
</div>
</td>
<td class="quick-book-last">
<div class="ticket-style-quick-book">
<select class="adult-ticket-select">
<option value="0">0</option>
<option value="1">1</option>
</select>
<span class="quick-book-price">$185/ea</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<input type="submit" class="quick-book-submit-btn" name="quick-book-submit-btn" value="" />
</form>
</div><!-- end quick-book-form div -->
For the calendar, indeed you could use the jQuery-ui one. It is a good widget, easy to configure and very powerful.
http://jqueryui.com/demos/datepicker/
You can configure it to put the format you want in the input (YYYY-MM-DD for example)
Finally you should add a listener on the submit event, to perform your action modification:
// This function will be call before the submit
$("#YOUR_FORM_ID").submit(function(submitEvent) {
// Initialize the query param array
var queryParams = [];
// Fill the query param with values
queryParams.push("action=quicksale");
queryParams.push("venueid=1");
queryParams.push("businessdate=" + $("#YOUR_INPUT_DATE_ID").val());
// etc...
// Finally update the form action
$(this).attr('action', 'https://sales.site.com/?' + queryParams.join("&"));
// The action has been updated
// The submit will process
});