How to Export in CSV o XLS

pepepa 07 May, 2015
Hi
I wanted us know how to export the data in the database from Frontend registered with the Form. Possibly even stacked.
I with the old system I created a Form and used the following code, now I do not know how.

Thanks
<?php
$app = &JFactory::getApplication();

?>
 
<div class="ccms_form_element cfdiv_select" id="tabella_container_div">
<label>Tabella</label><select size="1" class=" validate['required']" title="" 
type="select" name="tabella">
<option value="" selected>Scegli una tabella</option>
<?php
 //questo codice permette di popolare la dropdown con le tabelle di chronforms
 
    $db =& JFactory::getDBO();         
    $query = "SHOW TABLES LIKE '%chronoforms_Iscrizioni1%'";
    //$query = "SHOW TABLES ";
    $db->setQuery($query);
    $nomes = $db->loadResultArray();
//print_r($nomes);
    $nome_options = "";
      $i=0;
      foreach ( $nomes as $v ) {
      $nome_options .= "<option value='".$nomes[$i]."' >".$nomes[$i]."</option>";
      $i++;
     
 
     echo $nome_options;
?>
</select>
<div title="Tabella" rel="Seleziona una tabella da esportare" class="tooltipimg">
<a href="#">?</a></div><div class="small-message">Seleziona una tabella</div>
<div class="clear"></div><div id="error-message-tabella"></div></div>
<div class="ccms_form_element cfdiv_select" id="separatore_container_div">
<label>Separatore</label><select size="1" class="" title="" type="select" name="separatore">
    <option value="">Scegli un separatore</option>
    <option value=",">Virgola</option>
    <option value=";">Punto e virgola</option>
    <option value="|">Barra verticale</option>
    <option value="tab">Tabulazione</option>
 
 
 
</select>
<div title="Separatore" rel="Scegli un separatore dei campi della tabella" class="tooltipimg">
<a href="#">?</a>
</div><div class="small-message">Scegli un separatore dei campi della tabella</div>
<div class="clear"></div><div id="error-message-separatore"></div></div>
<div class="ccms_form_element cfdiv_submit" id="input_submit_2_container_div">
<input name="input_submit_2" class="" value="Submit" type="submit" />
<div class="clear"></div><div id="error-message-input_submit_2"></div></div>

<?php } ?>
GreyHead 07 May, 2015
Hi pepepa,

It looks as if that will give you a drop-down list of tables. It should still work in a CFv5 form if you add it to a custom Code element.

Bob
pepepa 07 May, 2015
HI GreyHead

I created a new Form simple, pasted the code and changed the name of the database but does not work in CFv5.
It makes me choose the database but does not appear in the drop-down menu does not make me any database and select the separator.
With the old ChronoForms worked perfectly.
I attach two photos in before the old system is working and what is wrong in the second.
What should I correct?

thanks
GreyHead 08 May, 2015
Hi pepepa,

It looks to me as if you have a bug in your PHP, I think that the last <?php } ?> is in the wrong place.

Bob
pepepa 08 May, 2015
Hi
Thanks
You can give me a solution?
GreyHead 09 May, 2015
Hi pepepa,

Only to suggest that you carefully debug your custom code :-(

Bob
pepepa 09 May, 2015
Hello Bob
I copied the code so I would not know how to change it :-(
thanks
GreyHead 13 May, 2015
Hi pepepa,

Then you may need help from someone with more coding experience. It's not clear to me what this code is intended to do.

Bob
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount
hostinger