This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 2

Display record number / counter in the page


  1. cyberjorge
    Member

    I want the visitors to see the total # of records in the form, like seeing the total sign-up's.

    Is this possible? How to accomplish this?

    Posted 15 years ago #
  2. cyberjorge
    Member

    Anyone please?

    Is it possible to display the Entry Number on the form page?
    I want other visitors to see the current number of persons who filled up the form before they fill up.

    Thanks in advance.

    Posted 15 years ago #
  3. cyberjorge
    Member

    I tried borrowing a code from manage_form.php by using the ff. code on top of the view-functions.php:

    foreach ($form_list as $data){

    if(!empty($data['form_active'])){
    $form_status = 'Accepting Entries';
    $image_status = 'checkbox.gif';
    $activation_text = 'Disable this form';
    $activation_link = 'disable_form';
    }else{
    $form_status = 'Inactive';
    $image_status = 'disabled.gif';
    $activation_text = 'Enable this form';
    $activation_link = 'enable_form';
    };

    //get total entries for each form
    foreach ($form_id_array as $form_id){
    //get all time entries
    $query = "select count(*) total_entry from ap_form_{$form_id}
    `
    ";
    $result = do_query($query);
    $row = do_fetch_result($result);
    $entries[$form_id]['total'] = $row['total_entry'];

    and

    <?php echo $entries[$data['form_id']]['total']; ?>

    inside the html tag. But now I get the following error:

    Parse error: syntax error, unexpected '[', expecting ']' in /wamp/public_html/form/includes/view-functions.php on line 1875

    Any idea? Thanks a lot in advance!

    Posted 15 years ago #
  4. redityo

    Hi,

    You can try my code to show form entries count. Try to follow these steps :

    1. Edit view-functions.php file and go to around line 1823 ~ 1824. You will see this :

    //If you would like to remove the "Powered by MachForm" link..
    $form_markup = <<<EOT

    add these code exactly above that line

    $query = 'select count(1) total_entry from ap_form_' . $form_id;
    $result = do_query($query);
    $row = do_fetch_result($result);
    
    $total_entry = $row['total_entry'];
    $total_message = '<div id="total_message">You have ' . $total_entry . ' entries for this form</div>';

    2. Go to line 1844, you will see this :

    <h1><a>{$form->name}</a></h1>

    put the code bellow that line

    {$total_message}

    It will show your form entries on your form


    MachForm Support

    Posted 15 years ago #
  5. cyberjorge
    Member

    Thank you very much!

    That solved it!

    Posted 15 years ago #

RSS feed for this topic

Reply