• 571

    (@571-1)


    <select name="list">
    <?php foreach ($data as $entry): ?>
    
    <option><?php echo $entry[1]; ?></option>
    
    <?php endforeach; ?>
    </select>

    i’ve got this working in a drop down menu. only because there are multiple cell’s with the same name it is showing all same name several times.

    Is there a way to only show the different values, and get all same values under 1 value?

    if someone have an example of a drop down, with few lines would also be great!

    i’ve got this already; (it should go from the first list, to the second, third, forth… and then send this values together with the other values on the same row from excel to a page)

    <?php $data = wp_excel_cms_get("database"); ?>
    
    <form role="search" method="get" class="row search-form" action="<?php echo esc_url( home_url( '/' ) ); ?>">
    	<div class="search-form">
    
    <select name="list1">
    <?php foreach ($data as $entry): ?>
    
    <option><?php echo $entry[0]; ?></option>
    
    <?php endforeach; ?>
    </select>
    
    <select name="list2">
    <?php foreach ($data as $entry): ?>
    
    <option><?php echo $entry[1]; ?></option>
    
    <?php endforeach; ?>
    </select>
    
    <select name="list3">
    <?php foreach ($data as $entry): ?>
    
    <option><?php echo $entry[2]; ?></option>
    
    <?php endforeach; ?>
    </select>
    
    <select name="list4">
    <?php foreach ($data as $entry): ?>
    
    <option><?php echo $entry[3]; ?></option>
    
    <?php endforeach; ?>
    </select>
    
    <select name="list5">
    <?php foreach ($data as $entry): ?>
    
    <option><?php echo $entry[4]; ?></option>
    
    <?php endforeach; ?>
    </select>
    
    <input type="submit" value="Go" onclick="ListSelectRedirect(''); return false;"/>
    
    </form>

    https://www.ads-software.com/plugins/wp-excel-cms/

Viewing 1 replies (of 1 total)
  • Plugin Author webteilchen

    (@webteilchen)

    You could put every item in an array an then check if the item is in the array if yes: show it, else: skip it.

    <?php $shown = array(); ?>
    <select name="list">
    <?php foreach ($data as $entry): ?>
       <?php if(in_array($shown)): ?>
          <option><?php echo $entry[1]; ?></option>
          <?php $shown[] = $entry[1]; ?>
       <?php endif; ?>
    <?php endforeach; ?>
    </select>

    I hope that helps.

Viewing 1 replies (of 1 total)
  • The topic ‘multiple data input’ is closed to new replies.