The following warnings occurred: | ||||||||||||||||||||||||
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
|
Need a point in the right direction - Printable Version +- UserSpice (https://userspice.com/forums) +-- Forum: General (https://userspice.com/forums/forumdisplay.php?fid=20) +--- Forum: New to UserSpice? (https://userspice.com/forums/forumdisplay.php?fid=22) +--- Thread: Need a point in the right direction (/showthread.php?tid=348) |
Need a point in the right direction - mudmin - 11-24-2016 I can't run your code without my db being setup correctly. I actually have a /pizza install on my other computer, but I'm not there. Javascript is normally what you would use for preventing a button from being clicked multiple times. There are a few php hackery ways to do it though. So, since you're storing the on_break in the users table as 0 or 1 AND refreshing the page with that redirect message after update, you should be able to go down to the button part of your form and do this. Code: <?php Code: if($user->data()->on_break != 1) { Code: ?> Code: //your plain submit button in html here Code: <?php } ?> That will just hide your button if on_break = 1. Need a point in the right direction - sandrews - 11-24-2016 Nice, that works perfectly. Clearly I need a refresher in PHP...time to go watch some PluralSight videos lol Need a point in the right direction - mudmin - 11-24-2016 Great! I really want to teach a class on userspice. I'm actually not a very good programmer so I've had to learn things like that to compensate for the fact that I never had time to learn javascript well Need a point in the right direction - sandrews - 11-24-2016 lol my problem was I could never pick a language to actually settle down into. I've done a little Java, a little JS, a little PHP, a little Python, a little Ruby, a little Swift, a little Perl, and a lot of BASH. So I know just enough in too many languages to really remember any of it worth a damn. Probably why I ended up going the Linux admin route instead, but now I'm getting bored again and picking up on DevOps....which requires programming knowledge. |