Jump to content

Irji

New Members
  • Posts

    1
  • Joined

  • Last visited

Irji's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have a foreach multistep with buttons : <?php $layout = array('one', 'too', 'three', 'four'); $keys= array_keys($layout); $total=count($keys); ?> <div class="steps"> <?php $i=0;$step_name=''; foreach ($layout as $value): $i++; switch ($value) { case 'one': $step_name=esc_html__('One'); break; case 'too': $step_name=esc_html__('Too'); break; case 'three': $step_name=esc_html__('Three'); break; case 'four': $step_name=esc_html__('Four'); break; } ?> <?php endforeach;?> </div> <form action="<?php echo esc_url($action); ?>" method="post" id="submit_form" class="manager-form" enctype="multipart/form-data"> foreach ($layout as $value) { $index = array_search($value,$keys); $prev_key = $next_key= ''; if($index>0) { $prev_key = $keys[$index-1]; } if($index<$total-1){ $next_key = $keys[$index+1]; } ?> <fieldset tabindex="-1" id="step-<?php echo esc_attr($value); ?>"> <div class="ere-step-nav"> <?php if($prev_key!='1'):?> <button class="btn-prev" aria-controls="step-<?php echo esc_attr($prev_key); ?>" 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; ?> <button class="btn-all" type="button" title="<?php esc_attr_e('All Fields') ?>"><?php esc_html_e('All') ?></button> <?php if($next_key!=''):?> <button class="btn-next" aria-controls="step-<?php echo esc_attr($next_key); ?>" type="button" title="<?php esc_attr_e('Next') ?>"><span><?php esc_html_e('Next') ?></span><i class="fa fa-angle-right"></i></button> <?php else:?> <input type="submit" name="submit_button" class="btn-submit" value="Submit>"/> <?php endif;?> </div> </fieldset> </form> Everything is working. But the Prev button appears on the first step (and should be from the second step). The Submit button should be on the last step instead of the Next button, but it's not there. I'm just starting to learn php. Please tell me how can I fix this. What am I doing wrong. Any help would be appreciated. Thanks!
×
×
  • 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.