Jump to content

BillInKCMO

New Members
  • Posts

    6
  • Joined

  • Last visited

Everything posted by BillInKCMO

  1. Wasn't sure where to put this one. I have to send quite a lot of text in a URL, probably not more than the HTTP spec can handle, but still, a lot of text. Going from a javascript window.open url with the text compressed to using that string on the server side in PHP decompressed. Is there functionality in common between javascript and PHP that would work (without external libraries)?
  2. So I have learned over the years. When I got the notification that I was close to being banned for asking so many questions I gave up.\ I'm largely self-taught and while I could - without thinking about it too much - write you a really efficient CRM or shopping cart, there are some of the finer points that I'm still learning. Thanks for the answer!
  3. I think you mean, add 1 when there is an UNsuccessful login. ...and then, the next step is to set the counter to zero if there's a successful logon. A less secure way would be to store the count as a cookie, but if you've got a tech savvy user they can just delete it and have infinite attempts. OR make the login process an Ajax POST and do the counting with in-page javascript, though there's no long term storage for that beyond cookies. DB is the best answer, frankly.
  4. Weary of getting frowned at over on StackOverflow, so...HI THERE. Consider these two blocks of code. Is there any functional difference between them? class myClass { private static $instance; public static function instance(){ if ( ! isset( self::$instance ) ) { self::$instance = new self; } return self::$instance; } public function __construct() { } } $my_class_name = MY_CLASS_NAME::instance(); and class myClass { public function __construct() { // blah blah blah } } $my_class_name = new MY_CLASS_NAME();
  5. I don't think you've posted your code accurately: you said everything is working, but on my screen it doesn't make sense. I presume you want four fieldlists labeled "One," "Too," etc. You can't accomplish this with the code you posted: you print the labels first all at once, the fieldlists second all at once; thus, all of the labels are clustered together on top of the fieldlists. You've made this much, much harder than it needs to be. $keys= array_keys($layout); $total=count($keys); You don't need this. You can get the same result with $total = count($layout); Your first foreach loop echos values but on the screen they're not attached to anything. They're just sorta hangin' out there. Lose it. You don't need it. You don't need prev_key and next_key. If what you display is entirely dependent upon the index at the time, you just need to know that index. For that you can do this in your second foreach loop: foreach ($layout as $k => $v) { $k is your index. if($prev_key!='1'): ... if($next_key!=''): If your goal is to put buttons in a certain order, and that order is determined arbitrarily using the layout array (i.e. if idx = 1 do buttonx, if idx = 2 do buttony), you don't need these variables or checks. Your entire code can be written as an array definition and single foreach loop, like so: $layout = array('One', 'Too', 'Three', 'Four'); $total = count($layout); foreach($layout as $k => $value) { // $k is your index ?> <form action="myaction" method="post" id="submit_form" class="manager-form" enctype="multipart/form-data"> <fieldset tabindex="-1" id="step-<?php echo esc_attr($value); ?>"> <!-- fieldset is a block level element, so you don't need the div tag --> <!-- div class="ere-step-nav" --> <?php if($k > 0): ?> <!-- only show previous when we're not on the zero-th element --> <button class="btn-prev" aria-controls="step-<?php echo esc_attr($k); ?>" type="button" title="<?php esc_attr_e('Previous') ?>"><i class="fa fa-angle-left"></i><span><?php esc_html_e('Previous') ?></span></button> <?php endif; ?> <!-- this button shows all the time --> <button class="btn-all" type="button" title="<?php esc_attr_e('All Fields') ?>"><?php esc_html_e('All') ?></button> <?php if ($k < ($total - 1)): ?> <!-- only show the next button when we're not on the last element --> <button class="btn-next" aria-controls="step-<?php echo esc_attr($k); ?>" type="button" title="<?php esc_attr_e('Next') ?>"><span><?php esc_html_e('Next') ?></span><i class="fa fa-angle-right"></i></button> <?php endif; ?> <!-- the submit button shows all the time --> <input type="submit" name="submit_button" class="btn-submit" value="Submit>"/> <!-- /div --> </fieldset> </form> <?php } Questions?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.