TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   preselect from drop list php (http://www.talkphp.com/general/6127-preselect-drop-list-php.html)

KingOfTheSouth 02-14-2012 04:19 PM

preselect from drop list php
 
Hey all I have an issue I need some help on. I have two drop down lists in html that are being populated by php. My first drop down is called "IN" and you select a time time then when finished with task you select "OUT" and select the time. It is just like a time-sheet. But Once I get my first "OUT" selection for the day I want the "IN" to be populated by the last "OUT" that was selected. Does this make any sense?

tony 02-15-2012 04:07 AM

That seems more like a javascript would help you on that one. Is that how you are trying to do it or purely in PHP? That could also be done.

KingOfTheSouth 02-15-2012 03:57 PM

JavaScript is what I wanted to do at first, but I suck at JavaScript it is so confusing. I was thinking PHP but didn't know if it could be done like that.

AxelG 02-18-2012 08:21 PM

There is easy solution in javascript using jQuery. It is more easy and faster to create javascript with jQuery.

KingOfTheSouth 02-21-2012 04:03 PM

I am not that good at any JavaScripting I have used JQuery but just stuff from JQuery.com so I don't know it that well.

KingOfTheSouth 03-13-2012 06:31 PM

I got this figured out. Where is what I did...

PHP Code:

<select name="start">
          <option value="">-Select One-</option>
          <?php
$query 
"SELECT " $tab['timesheet'] . ".stop FROM " $tab['timesheet'] . " WHERE user = " $user['id'] . " ORDER BY  timesheets.stop DESC LIMIT 1";

$result   mysql_fetch_array(mysql_query($query));
$lastTime date("g:i A"strtotime("01/27/2012 " $result['stop']));
$start    date('G'strtotime("01/27/2012"));
$minutes  0;

for (
$i 0$i 96$i++) {
                
$start date("g:i A"strtotime("01/27/2012 + " $minutes " minutes"));
                
?>
          <option value="<?php
                
echo "$start";
?><?php
                
echo ($start == $lastTime) ? "selected" "";
?> >
          <?php
                
echo $start;
?>
         </option>
          <?php
                $minutes 
+= 15;
                
$start date("G"strtotime("01/27/2012 + " $minutes " minutes"));
//$i = 0; $i < 96; $i++
?>
       </select>


chumpaksome 07-19-2012 08:28 PM

JavaScript is what I wanted to do at first, but I suck at JavaScript it is so confusing. I was thinking PHP but didn't know if it could be done like that kind of thing if you want more then Click here for more detail

chinikumy 07-20-2012 07:54 PM

That seems more like a javascript would help you on that one. Is that how you are trying to do it or purely in PHP? That could also be done Payday loans.

infoleather 07-31-2012 04:19 AM

How did you attempt to do this, or purely in PHP?
Take full use of the experience about leather jacket mink collar will be helpful to gain knowledge about zipper front leather jacket and also similar

mtttt 09-04-2012 01:29 AM

It is more simple and quicker to make javascript with jQuery.

---------
http://www.faucetsuperdeal.com


All times are GMT. The time now is 08:53 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0