PHP code for Contact Form

I have been using simple contact form for ages now
www.freecontactform.com/email_form.php

I switched to a new reseller host and suddenly that form script doesn’t work. It does not send any emails.

I contacted the support and they asked me to build the form around the following code:
[php]<?

    $mailto="[email protected]";
    $file="thanks.htm";
    $pcount=0;
    $gcount=0;
    $subject = "Mail from Enquiry Form";

    $from="[email protected]";
    while (list($key,$val)=each($_POST))
    {
    $pstr = $pstr."$key : $val \n ";
    ++$pcount;

    }
    while (list($key,$val)=each($_GET))
    {
    $gstr = $gstr."$key : $val \n ";
    ++$gcount;

    }
    if ($pcount > $gcount)
    {
    $message_body=$pstr;
    mail($mailto,$subject,$message_body,"From:".$from);

    include("$file");
    }
    else
    {
    $message_body=$gstr;

    mail($mailto,$subject,$message_body,"From:".$from);
    include("$file");
    }
    ?>[/php]

Reference Link http://manage.resellerclub.com/kb/servlet/KBServlet/faq1060.html

Can anyone help me out with making an html form using that code.

Thanks for your time.

Looking at that script, any HTML Contact form will work.

It just takes all the POST values and sends it to you in an email. Which means any input fields on the contact form will be sent to you.

Sponsor our Newsletter | Privacy Policy | Terms of Service