WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form DB
[resolved] different tables for for each choice (5 posts)

  1. Panos
    Member
    Posted 1 year ago #

    Hello. I'am using my own short code as you instructed me in this topic Now I want to create lets say two different tables instead of one that will identified by a choice of a check box. In this example the check box is "delivery place".
    Is this possible?

    require_once(ABSPATH . 'wp-content/plugins/contact-form-7-to-database-extension/CFDBFormIterator.php');
    $exp = new CFDBFormIterator();
    $exp->export($atts['form'], $atts);
    echo '<table border="1">
    <thead>
    <<tr>
    <th>Name</th>
    <th>Oranges</th>
    <th> Delivery Place</th>
    </tr>
    </thead>
    <tbody>';
    
    $summary = 0;
    while ($row = $exp->nextRow()) {
        echo '<tr>';
        echo '<td>'. $row['name'] . '</td>';
        echo '<td>'. $row['oranges'] . '</td>';
        echo '<td>'. $row['delivery'] . '</td>';
        echo '</tr>';
           }

    Sorry for my bad English if wasn't understandable tell me to explain again.

    http://wordpress.org/extend/plugins/contact-form-7-to-database-extension/

  2. Michael Simpson
    Member
    Plugin Author

    Posted 1 year ago #

  3. Panos
    Member
    Posted 1 year ago #

    For the above code I added this to while loop

    while ($row = $exp->nextRow() && $row['delivey']=="Place 1") {
    echo '<tr>';
        echo '<td>'. $row['name'] . '</td>';
    }

    but it doesnt work
    Could someone tell me what I did wrong? I am newbie in programing.

  4. Michael Simpson
    Member
    Plugin Author

    Posted 1 year ago #

    I think you want this:

    while ($row = $exp->nextRow()) {
       if ($row['delivey']=="Place 1") {
          echo '<tr>';
          echo '<td>'. $row['name'] . '</td>';
          echo '</tr>';
       }
    }
  5. Panos
    Member
    Posted 1 year ago #

    It worked. Thank you.
    Your support forum always very helpful.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.