- <!DOCTYPE html>
-
<html>
-
<head>
-
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
-
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
-
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
-
-
<script>
-
$(document).ready(function() {
-
$(".datepicker").datepicker()
-
});
-
</script>
-
</head>
-
<body>
-
<?php
-
error_reporting(E_PARSE);
-
$status = $_POST['status'];
-
$driver_name= $_POST['driver_name'];
-
$from=date('y-m-d',strtotime($_POST['date_from']));
-
$to=date('y-m-d',strtotime($_POST['date_to']));
-
$conn = mysqli_connect('localhost', 'root', '', 'punbus') or
-
die("Database not connected" . mysqli_error());
-
if(isset($_POST['sub'])) {
-
foreach($status as $k=>$s){
-
$ins = "insert into driver_status(driver_name,status,date_from,date_to) VALUES
-
('".$driver_name[$k]."','$s','$from','$to')";
-
if (mysqli_query($conn, $ins)) {
-
echo "added";
-
} else {
-
echo "NOT" . mysqli_error($conn);
-
}
-
}
-
}
-
-
$sel = 'select Driver_name from driver_master';
-
$query = mysqli_query($conn, $sel);
-
-
echo "<form action='driver_status.php' method='post'>";
-
echo "<table cellpadding=5>";
-
echo "<tr>";
-
echo "<th>Driver Name</th>";
-
echo "<th>Status</th>";
-
echo "<th>From</th>";
-
echo "<th>To</th>";
-
echo "</tr>";
-
while($row=mysqli_fetch_assoc($query)){
-
echo "<tr><td>".$row['Driver_name']
-
."<input type=\"hidden\" name=\"driver_name[]\" value=\"".$row['Driver_name']."\"/></td>";
-
$sel1='select d_status from status';
-
$query1=mysqli_query($conn,$sel1);
-
echo "<td><select name=\"status[]\">";
-
while($row1=mysqli_fetch_assoc($query1)){
-
echo "<option value=\"".$row1['d_status']."\">".$row1['d_status']."</option>";
-
}
-
echo "</select></td>";
-
echo "<td>".'<input type="text" name="date_from" class="datepicker">'."</td>";
-
echo "<td>".'<input type="text" name="date_to" class="datepicker">'."</td>";
-
echo "</tr>";
-
}
-
echo "</table>";
-
echo '<input type="submit" name="sub" value="Update"/>';
-
echo "</form>";
-
?>
-
</body>
-
</html>
in above code i can store values from drop down boxes to database by using foreach loop but cant store date from jquery datepicker. Only last selected date is getting stored in database.
3 1527
Only last selected date is getting stored in database.
because you only get one entry per input name if you don’t use bracket notation. dump the $_POST array to see the data PHP receives.
Note: mysqli_connect() never returns false, even if the connection fails.
SO, Plz can u tell me? what do i do?
I recommend to use the bracket notation for the form field names.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Tom Petersen |
last post by:
I have a drop down box where the choices are populated from a database
query, this part works fine:
<option value><% = strEmail %></option>
I was wondering if it is possible to keep the value as...
|
by: kvrdev1 |
last post by:
What reference do I need to add in to be able to use a date drop-down control
within my web application?
Thank you!
-Valerie
|
by: rishu banerjee |
last post by:
hi all. I'm new to ASP. can anyone help me in getting values of a drop down to be displayed in a textarea.say if we have the drop down elements as color, flower,..etc. as we select color, it should...
|
by: Slickuser |
last post by:
Hi,
I would like to use date() function show in the drop down menu start
from today to next 1 Month.
So it will be something like this.
4/3/2008
4/4/2008
4/5/2008
|
by: selvasoft |
last post by:
Hi
Please any one help me i want list out the values in drop down box.
But the values from my database.
How can am select that value from my database using JSP.give me example code
pleas.
|
by: jimgym1989 |
last post by:
Hi there,
I have 2 PHP files, memeber.php & view.php
This is my member.php
while($row = mysql_fetch_array($strSQL)){
$data .= "<tr>";
$data .= "<td>";
$data .= "<input type='checkbox'...
|
by: Jincythomas |
last post by:
I want to load multiple images using drop down list
it has to be from database.My project is going to have 3 drop down list on the basis of each selection I need to load the images from...
|
by: geethasakthi |
last post by:
hi friends,
i need some help for my project.when i select the country in drop down menu automatically display the state and city.
give some idea
Thanks
|
by: manjm48 |
last post by:
Drop down values not populating while opening MS Access application in 2010 version which is developed in 2000 version. But the same file while accessing through 2007 version of MS Access, the...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |