Hi all,
This is my first attempt at anything to do with php/mysql so any help will be greatly appreciated.
I have been set a challenge to come up with a web app to enable staff to log on to the page, select their name in a drop down box and then set their current location and time due to leave that location. Then press submit to update their record on staff database.
So far I have gotten any names in database loaded into a drop down box and have 2 further text fields to enter in location and time details. Finding a time function is for another day!
here's my code:
So far so good but for the life of me I can't find a tutorial to show me how to handle the selection. What I want this app to do is update the record of the person selected with the inputted location and time overiding the last input they did.
Any pointers please?
This is my first attempt at anything to do with php/mysql so any help will be greatly appreciated.
I have been set a challenge to come up with a web app to enable staff to log on to the page, select their name in a drop down box and then set their current location and time due to leave that location. Then press submit to update their record on staff database.
So far I have gotten any names in database loaded into a drop down box and have 2 further text fields to enter in location and time details. Finding a time function is for another day!
here's my code:
Code:
<html>
<?php
$connection = mysql_connect("localhost", "root", "");
if(!$connection)
{
die("database failed " . mysql_error());
}
$db_select = mysql_select_db("staff_status", $connection);
if(!$db_select)
{
die("database selection failed " .mysql_error());
}
echo $db_select;
?>
<form>
<select>
<?php
$sql="SELECT id,staff_name FROM status_staff";
$result =mysql_query($sql);
while ($data=mysql_fetch_assoc($result))
{
echo ("<option value=".$data['id'].">". $data['staff_name']."</option>");
?>
<?php } ?>
</select>
</form>
<form action="drop.php" method="post">
<br>
Location:
<input type="text" name="location">
<br>
Time Leaving:
<input type="text" name="time">
<br>
<input type="Submit">
</html>
Any pointers please?
Comment