Grow your CSS skills. Land your dream job.

ISSUE! Form Not collecting information???

  • # December 19, 2011 at 5:33 pm

    Hello,
    I am working on a site which is in a different language, and have added a form to a page called request when clicked submit it is processed by a page called contact.php and so when the user has clicked submit they should be redirected to a page called thankyou.html letting them know that their message is sent, i have edited the php form so when i click submit the form is sent and i am redirected to the thankyou.html viewing my message is ent however the php is not collecting all the information from the request page because when i view the email i just see the subject line, and couple of the information collected, so please let me know how this issue can be solved, thanks.

    HTML,





    نام دستگاه


    برند دستگاه


    ظرفیت دستگاه


    مدل دستگاه


    سال ساخت دستگاه


    توضیحات اضافی



    نام و نام خانوادگی شما


    تلفن همراه


    تلفن ثابت


    فکس


    ایمیل


    توضیحات اضافی




    PHP,



    < ?php
    $nmachine = $_POST ;
    $bmachine = $_POST ;
    $zmachine = $_POST ;
    $mdmachine = $_POST ;
    $smachine = $_POST ;
    $t1machine = $_POST ;
    $yname = $_POST ;
    $yp = $_POST ;
    $ym = $_POST ;
    $fax = $_POST ;
    $email = $_POST ;
    $t2machine = $_POST ;
    $submit = $_POST ;

    $sendTo = "myemail@gmail.com";
    $subject = "company form";
    $message = "$t1machine
    from $yname, $yp";

    $headers = "From: $yname < $email> rn";
    $headers .= "X-Mailer:PHP/rn";
    $headers .= "MIME-Version:1.0rn";
    $headers .= "Content-type:text/plain; charset=iso-8859-1rn";

    if(isset($submit)){
    $sent = mail($sendTo, $subject, $message, $headers);

    if ($sent) {
    header("location:./thankyou.html");
    }else{
    echo "Message Failed";
    }

    }
    ?>
    # December 19, 2011 at 7:54 pm

    i think is the mail function structure.
    mail is structured like that : to, subject, message.
    After message you can put additional headers informations.
    so i think is better do like that ( this is a very quick and basic way ) :

    < ?php

    $field1 = $_POST ;
    $field2 = $_POST ;

    if(isset($field1) && isset($field2)){
    $headers = 'MIME-Version: 1.0' . "rn";
    $headers .= 'Content-type: text/html;charset=utf-8' . "rn";
    $headers .= "From:Your site name";
    $to= 'your email';
    $subject= 'Email from etc...';
    $message= "$field1 is the first field you type. $field2 is the second one.";
    if(@mail($to, $subject, $message,$headers)){
    header("Location: thanks.html");
    }
    else{
    header("Location: error.html");
    }
    }else{
    echo 'complete the form.';
    }

    ?>

    i hope this is correct and helps you! :)

    bye

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

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".