Tagged: , , ,

Viewing 16 posts - 1 through 16 (of 16 total)
  • Author
  • #474

    Thanks for all of your great support on these themes! I have been wondering how can I add the field “Where did you hear about us?” to the contact page?

    This would be a non mandatory field, just like the website field.



    I’m sure this is possible to add to Kriesi’s contact form. But there are many plugins which will do this “out-of-the-box”. I use Contact Form 7 on my site. It’s free and has many features (file uploading, etc.)


    The Dude


    Thanks man! I would love to take a look at learning this one soon – but for this one Id like to add it to the Cleancut contact for that is already there! Is this at all possible without too much trouble?


    Just replace following code in template_contact.php:

    <p><input name="website" class="text_input" type="text" id="website" size="20" value="<?php if (isset($the_website))  echo $the_website?>"/><label for="website"><?php _e('Website','cleancut'); ?></label></p>

    with this one:

    <p><input name="website" class="text_input" type="text" id="website" size="20" value="<?php if (isset($the_website))  echo $the_website?>"/><label for="website"><?php _e('Website','cleancut'); ?></label></p>
    <p><input name="hearaboutus" class="text_input" type="text" id="hearaboutus" size="20" value="<?php if (isset($hearaboutus)) echo $hearaboutus?>"/><label for="hearaboutus"><?php _e('Where did you here about us','cleancut'); ?></label></p>

    Now you CAN edit send.php. It’s not obligatory. Kriesi made a comment in send.php:

    # want to add aditional fields? just add them to the form in template_contact.php,
    # you dont have to edit this file

    The advantage of editing send.php is that you’ve more control over the output:

    So here we go – replace following in send.php:

    $the_website = $_POST['website'];


    $the_website = $_POST['website'];
    $hearaboutus = $_POST['hearaboutus'];

    next replace:

    $already_used = array('yourname','email','website','message','ajax','myemail','myblogname','Send');


    $already_used = array('yourname','email','website','hearaboutus','message','ajax','myemail','myblogname','Send');

    and replace:

    Website: $the_website <br />
    $attach <br />


    Website: $the_website <br />
    Where did you here about us: $hearaboutus <br/>
    $attach <br />

    The Dude


    Great!!!!! Thanks so much!!



    I want to add a checkbox in my form. Is this correct what I have done?

    <p><input name="photos" class="text_input" type="checkbox" id="photos" size="20" value="<?php if (isset($photos)) echo $photos?>"/><label for="photos"><?php _e('I require additional photos?','cleancut'); ?></label></p>

    I have added the required elements to other files as mentioned above:

    $photos = $_POST;

    Additional photos: $photos

    …etc – is that correct?


    Yes it should work as expected – I must admit I didn’t test it though. Please backup send.php and contact.php and upload your modified files.


    Hi Dude in the email sent to me it does not show the result of the checkbox. I have updated my send.php but still it does not work properly. Can I email you my files?


    Please, send me a mail to

    (Email address hidden if logged out)

    The Dude


    The admin of http://meloniq.net contacted me because he wrote a tutorial on how to add contact fields. The article can be found here: http://blog.meloniq.net/2010/10/29/newscast-add-checkbox-field-to-contact-form/

    Again, thank you for helping us out and for sharing your ideas and this tutorial with our community.

    So here we go – how to add a contact field to newscast contact form/submit news form (but it’s also useful for other themes :D ) :

    1. Open file – „newscast/submit_news.php”

    2. Add code there where You want to have checkbox fields:

    <p class="mftype" ><label for="typeofcontact">Type of contact: </label><input type="checkbox" value="Flat" name="typeofcontact[]" />Flat <input type="checkbox" value="House" name="typeofcontact[]" />House</p>

    3. Open file – „newscast/send.php”

    4. Below declare lines in header of file add:

    $the_typeofcontact = $_POST['typeofcontact'];
    $the_typeofcontact_out = '';
    $ctoc = '';
    if(!empty($the_typeofcontact)) {
    $ctoc = count($the_typeofcontact);
    for($i=0; $i < $ctoc; $i++)
    $the_typeofcontact_out .= $the_typeofcontact[$i] . ", ";

    5. Add our field to array $already_used, like below:

    $already_used = array('yourname','email','website','message','ajax','myemail','myblogname','typeofcontact','Send');

    6. Next, print out this what we got, like below:

    (Type of contact: $the_typeofcontact_out)

    $message = "New message from  $the_name <br/>
    Mail: $the_email<br />
    Website: $the_website <br />
    Type of contact: $the_typeofcontact_out <br />
    $attach <br />
    Message: $message1 <br />";

    7. Open file – „newscast/js/custom.js”

    8. Find code like below (about line 887):

    formElements: form.find('textarea, select, input:text, input[type=hidden]'),

    And replace it with this one code:

    formElements: form.find('textarea, select, input:text, input[type=hidden]').end().form.find( ':checkbox' ).attr( 'checked', 'checked' ).end(),

    9. Save and upload new files.

    P.S. Enjoy Your checkbox fields;)


    hi, just wanna ask … ( i use display-3-in-1-business-portfolio-html)

    1.how can i add upload file field in my form ?

    2.how can i use recaptcha (from google) in my form?

    please help




    you can use contact form plugins like contact form 7 or cformsII – the standard contact form doesn’t support this field types.


    i meant for html purpose.


    You can use php form builder like: http://www.phpform.org/ to build advanced contact forms.


    thanks dude, got it and done it. Ur da best! i love full all of your template!


    Glad that I could help you :)

Viewing 16 posts - 1 through 16 (of 16 total)

The topic ‘Add field to contact form’ is closed to new replies.