e107help.org Q&A
0 like 0 dislike
How can i expand the standard contactform with one extra field, in contact.php there's an piece of code:

    if(!empty($_POST)) // support for custom fields in contact template.
        {
            foreach($_POST as $k=>$v)
            {
                $body .=  "<tr><td>".$k.":</td><td>".$tp->toEmail($v, true,'RAWTEXT')."</td></tr>";
            }
        }

How can i use that?
e107 version Git from today
closed
in Core by (16 points) 1 4
closed by

1 Answer

0 like 0 dislike
Best answer
Just add HTML code into contact template. Don't forget for the attribute name. New fields will be added automatically.
by (1.7k points) 12 37 50
selected by

THX Jimako, did not knwo it was so simple....

    <div class='control-group form-group'><label for='contactTel'>Telefoonnummer:</label>
        <input type='text' id='contactTel' title='Geef je telefoonnummer in.' name='telnr' required='required' size='30'  class='tbox form-control' value='' />
    </div>

And it works!!!

 

Alex

Learned something new myself as well, thanks!
Welcome to e107 Q&A, where you can ask questions and receive answers from other members of the e107 community.
857 questions
1,254 answers
2,177 comments
5,893 users