T
T
timers2020-05-04 14:54:50
PHP
timers, 2020-05-04 14:54:50

How to make a table select from a select for a query?

The code:

$list = "";
$result = $db->query( "SELECT * FROM ".PREFIX."_tovar_post WHERE id!=''" );
if( $db->num_rows( $result ) > 0 )
  {  
    while( $row = $db->get_row( $results ) )
      {
        $id = $row['id'];
        $title = htmlspecialchars( stripslashes( $row['title'] ), ENT_QUOTES, $config['charset'] );						
          
$list .= <<<HTML

      <option value="{$id}">ID:{$id} - {$title} </option>

HTML;
      }
  }
    else
  {
    $list = "<tr><td colspan=\"10\" style=\"padding: 15px; text-align: center;\">нет товаров</td></tr>";
  }


$list = <<<HTML


<div class="form-group">
  <div class="col-sm-4">
    <select class="uniform" name="id" >
      {$list}
    </select>						
  </div>
  <div class="col-sm-4">
    <select class="uniform" name="dost" >
      <option value="offer_dostavka">Доставка</option>
      <option value="offer_dostavka_uk">Доставка по УКР</option>
      <option value="offer_dostavka_ru">Доставка по РОС</option>
    </select>
  </div>
  <div class="col-sm-4">
    <input type="submit" name="submit" value="Привязать доставка" class="btn bg-brown-600 btn-sm btn-raised legitRipple" />
        </div>
 </div>	

HTML;

echo $list;


The bottom line is, I made the output of the goods, I need the table: ".PREFIX."_variant_dostavki_post to record the product ID in the tables: offer_dostavka, offer_dostavka_uk, offer_dostavka_ru i.e. by choice from the select list.

Implementation something did not find with an example, help to understand.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question