Jump to content

Passing values for a for loop


Xtremer360

Recommended Posts

I'm using the wizard js plugin and I'm trying to figure out how I can the value of the number of matches field to step 2 so that it can perform the for loop.

 

http://www.kansasoutlawwrestling.com/kowmanager/events/bookevent#step_2

 

<?php echo form_open('bookevent/newevent'); ?>
                        <?php echo form_label('Event Name', 'event_name'); ?>
                        <?php 
                        $options = array();
                        $options['default'] = 'Please Select An Option';
                        foreach ( $event_names AS $name ) 
                        {
                            $options[$name->id] = $name->event_name;
                        }
                        ?>
                        <?php echo form_dropdown('eventname', $options, 'default'); ?>
                        <?php echo form_label('Event Label', 'event_label'); ?>
                        <?php echo form_input('event_label', ''); ?>
                        <?php echo form_label('Booking Date', 'datetime'); ?>
                        <?php 
                        $attributes = array(
                            'id' => 'datetime',
                            'name' => 'datetime',
                            'class' => 'required',
                            'type' => 'datetime'
                        );
                        ?>
                        <?php echo form_input($attributes); ?>
                        <?php echo form_label('Number of Matches', 'num_matches'); ?>
                        <?php echo form_input('num_matches', ''); ?>
                        <?php echo form_label('Arena', 'arenas'); ?>
                        <?php 
                        $options = array();
                        $options['default'] = 'Please Select An Option';
                        foreach ( $arenas AS $arena )
                        {
                            $options[$arena->id] = $arena->arena_name;
                        }
                        ?>
                        <?php echo form_dropdown('arenas', $options, 'default'); ?>
                        <?php echo form_label('Introduction', 'introduction'); ?>
                        <?php echo form_textarea('introduction', ''); ?>
                    <?php echo form_close(); ?>
			</div>
            </div>
            <div class="wiz_page step_2">
                <div class="wiz_sidebar grid_3">
                    <span>2</span>
				<div>
				   <strong>Schedule Matches</strong>
                   <small></small>
				</div>
				<p></p>
			</div>
			<div class="wiz_content grid_9">
			    <h3>Schedule Matches</h3>
                    <?php echo form_open('bookevent/eventmatches'); ?>
                        <?php for ($i = 1; $i = $num_matches; $i++) { ?>
                            <?php echo form_label('Match Type', 'match_type'); ?>
                            <?php 
                            $options = array();
                            $options['default'] = 'Please Select An Option';
                            foreach ( $match_types AS $match_type ) 
                            {
                                $options[$match_type->id] = $match_type->match_type_name;
                            }
                            ?>
                            <?php echo form_dropdown('match_type', $options, 'default'); ?>
                            <?php echo form_label('Stipulations', 'stipulations'); ?>
                            <?php 
                            $options = array();
                            $options['default'] = 'Please Select An Option';
                            foreach ( $stipulations AS $stipulation ) 
                            {
                                $options[$stipulation->id] = $stipulation->stipulation_name;
                            }
                            ?>
                            <?php echo form_dropdown('match_type', $options, 'default'); ?>
                            <?php echo form_label('Title Defended', 'titles_defended'); ?>
                            <?php 
                            $options = array();
                            $options['default'] = 'Please Select An Option';
                            foreach ( $titles AS $title ) 
                            {
                                $options[$title->id] = $title->title_name;
                            }
                            ?>
                            <?php echo form_dropdown('titles_defended', $options, 'default'); ?>
                            <?php echo form_label('Referees', 'referees'); ?>
                            <?php 
                            $options = array();
                            $options['default'] = 'Please Select An Option';
                            foreach ( $referees AS $referee ) 
                            {
                                $options[$referee->id] = $referee->roster_name;
                            }
                            ?>
                            <?php echo form_dropdown('titles_defended', $options, 'default'); ?>
                            <?php echo form_label('Match Preview', 'match_preview'); ?>
                            <?php echo form_textarea('match_preview', ''); ?>
                        <?php } ?>
                    <?php echo form_close(); ?>

Link to comment
https://forums.phpfreaks.com/topic/265443-passing-values-for-a-for-loop/
Share on other sites

I do not understand either.  I will give you this bit of info though.

 

for loops

for($do_this_before_the_first_loop_starts;$do_another_loop_if_this_condition_is_met;$do_this_after_each_loop)

So, I'm not sure if:

for ($i = 1; $i = $num_matches; $i++)

is infinite, or just won't run period.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.