Jump to content

Newbie with question


Scott_Enriquez

Recommended Posts

As the title says, I'm very new to PHP.  This is from a scheduling system, the system is designed to ask the customer for a preferred time from a list of available times.  There will always only be one time available.  I'm trying to hide the option to select a time and have the one option automatically selected.

 

I was able to display the time using:

 

<?php echo $preferredTimesOptions [0] [0] ?>

 

But I can't figure out how, or even really where this value needs to be stored.  I've tried as many things as I could think of with my limited PHP knowledge to acheive this, but I'm at a loss.  I'm not sure if more code is needed to figure this out.  Any suggestions would be greatly appreciated.

 

 

<?php     if( $preferredTimes) : ?>
        <tr>
        <th>
        <?php /* echo M('Preferred Time'); */ ?>
        </th>
<?php
        $preferredTimesOptions = array();
        $t->setDateDb(20110516);
        $startDay = $t->getStartDay();
        foreach( $preferredTimes as $pt ){
            $t->setTimestamp( $startDay + $pt );
            $ptView = $t->formatTime();
            $preferredTimesOptions[] = array( $pt, $ptView );
            }
?>
        <td>
<?php         
echo $this->makeInput (
/* type */
    'select',
/* attributes */
    array(
        'id'        => 'preferred-time',
        'options'    => $preferredTimesOptions,
        'attr'        => array(
            ),
        )
    );
?>
        </td>
        </tr>
<?php     endif; ?>

Link to comment
https://forums.phpfreaks.com/topic/285990-newbie-with-question/
Share on other sites

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.