PHP Help ekak one..

melanxpress

Well-known member
  • Aug 18, 2008
    4,819
    223
    63
    32
    Malaysia & Kandy
    මම website එකක Contact Corm එකක් කරා. ඒක Japanese site එකක්.
    මම PHP දන්නේ නෑ එච්චරම. මම use කරපු PHP form එකේ UNICODE support කරන්නේ නෑ :no::oo::no::no:
    ඒ site එකට Japanese type support කරන්නේ නෑ.

    මේක තම මම use කරපු PHP form එක.
    මේක හදාගන්න විදියක් කියන්න පුලුවන්ද :)




    Code:
    [COLOR="red"]<?php[/COLOR]
      $name=htmlentities($_POST['name']);
      $email=htmlentities($_POST['email']);
      $phone=htmlentities($_POST['phone']);
      $message=htmlentities($_POST['message']);
     
      
    
     // you can specify which email you want your contact form to be emailed to here
    
      $toemail = [COLOR="red"]"[email protected]";[/COLOR]
      $subject = [COLOR="red"]"Ana Enterprises - Contact Form";[/COLOR]
    
      $headers =[COLOR="Red"] "MIME-Version: 1.0\n"[/COLOR]
                [COLOR="red"]."From: \"".$name."\" <".$email.">\n"[/COLOR]
                [COLOR="red"]."Content-type: text/html; charset=iso-8859-1\n"[/COLOR];
    
    [COLOR="rgb(0, 191, 255)"]$body = 	[/COLOR]
      			
    			
    			[COLOR="Red"]"Name: [/COLOR]".$name."<br>\n"
    			[COLOR="red"]."Email:[/COLOR] ".$email."<br>\n"
    			[COLOR="red"]."Phone: [/COLOR]".$phone."<br>\n"
    			[COLOR="red"]."Message[/COLOR]: ".$message."<br>\n";
    			
    
      
    
        [COLOR="Blue"]mail[/COLOR]($toemail, $subject, $body, $headers);
    	[COLOR="YellowGreen"]echo[/COLOR] "<script type='text/javascript'>
    <!--
    window.location = 'thankyou.html'
    //-->
    </script>";
    
    [COLOR="red"]?>[/COLOR]
    </body>
    </html>
     

    Attachments

    • contactForm.zip
      725 bytes · Views: 121

    melanxpress

    Well-known member
  • Aug 18, 2008
    4,819
    223
    63
    32
    Malaysia & Kandy
    use utf-8 header?

    Yes :( Here is the complete code

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"  />
    
    
    <title>Email Form</title>
    </head>
    
    <body>
    <?php
      $name=htmlentities($_POST['name']);
      $email=htmlentities($_POST['email']);
      $phone=htmlentities($_POST['phone']);
      $message=htmlentities($_POST['message']);
     
      
    
     // you can specify which email you want your contact form to be emailed to here
    
      $toemail = "[email protected]";
      $subject = "Ana Enterprises - Contact Form";
    
      $headers = "MIME-Version: 1.0\n"
                ."From: \"".$name."\" <".$email.">\n"
                ."Content-type: text/html; charset=iso-8859-1\n";
    
      $body = 	
      			
    			
    			"Name: ".$name."<br>\n"
    			."Email: ".$email."<br>\n"
    			."Phone: ".$phone."<br>\n"
    			."Message: ".$message."<br>\n";
    			
    
      
    
        mail($toemail, $subject, $body, $headers);
    	echo "<script type='text/javascript'>
    <!--
    window.location = 'thankyou.html'
    //-->
    </script>";
    
    ?>
    </body>
    </html>
     

    Gihanlasita

    Member
    May 21, 2007
    392
    3
    0
    $headers = "MIME-Version: 1.0\n"
    ."From: \"".$name."\" <".$email.">\n"
    ."Content-type: text/html; charset=UTF-8";
     

    melanxpress

    Well-known member
  • Aug 18, 2008
    4,819
    223
    63
    32
    Malaysia & Kandy
    Have you got Japanese fonts installed?

    මම සිංහල අකුරු type කරලා text fields fill කරා, Japanese type (windows වල Language මාරු කරාම එන font වලින්) කරලා text fields fill කරලා send කරා, මොකෙන් type කරත්, mail එක එන්නේ මෙන්න මෙහෙම

    Name: ¶¸à·™à¶
    Email: [email protected]
    Phone: මෙල෠න්
    Message: මෙල෠න්

    ....මෙන්න මෙහෙම එන්නේ :no::no::baffled:
     
    Last edited:

    melanxpress

    Well-known member
  • Aug 18, 2008
    4,819
    223
    63
    32
    Malaysia & Kandy
    show me the coding of your form

    FORM
    Code:
    <form id="formMail" name="formMail" method="post" action="contactForm.php">
               
               <p><span id="sprytextfield1">
                 <label for="name" class="phoneContact" style="margin-right:31px">お名前(かな)</label>
                 <input type="text" name="value01" id="name" class="formInput" />
                 <span class="textfieldRequiredMsg">*</span></span></p>
                 <p><span id="sprytextfield2">
                 <label for="mail" class="phoneContact" style="margin-right:72px">メール</label>
                 <input type="text" name="email" id="mail" class="formInput" />
                 <span class="textfieldRequiredMsg">*</span></span></p>
                 <p><span id="sprytextfield3">
                   <label for="phone" class="phoneContact" style="margin-right:52px">電話番号</label>
                   <input type="text" name="phone" id="phone" style="width:160px"/>
                 <span class="textfieldRequiredMsg">*</span></span></p>
                <span id="sprytextarea1">
                   <label for="message" class="phoneContact" style="position:relative">メッセージ</label><textarea name="message" id="message" cols="45" rows="5" class="contactMsg"></textarea>
                 </span>
                 
                 <button type="submit" name="submit" style="padding-left:149px" id="submin" value="submit" class="contactSubmit"><img src="images/contactGo.png"/>
                 </button></form>


    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"  />
    
    
    <title>Email Form</title>
    </head>
    
    <body>
    <?php
      $name=htmlentities($_POST['name']);
      $email=htmlentities($_POST['email']);
      $phone=htmlentities($_POST['phone']);
      $message=htmlentities($_POST['message']);
     
      
    
     // you can specify which email you want your contact form to be emailed to here
    
      $toemail = "[email protected]";
      $subject = "Ana Enterprises - Contact Form";
    
      $headers = "MIME-Version: 1.0\n"
                ."From: \"".$name."\" <".$email.">\n"
                ."Content-type: text/html; charset=iso-8859-1\n";
    
      $body = 	
      			
    			
    			"Name: ".$name."<br>\n"
    			."Email: ".$email."<br>\n"
    			."Phone: ".$phone."<br>\n"
    			."Message: ".$message."<br>\n";
    			
    
      
    
        mail($toemail, $subject, $body, $headers);
    	echo "<script type='text/javascript'>
    <!--
    window.location = 'thankyou.html'
    //-->
    </script>";
    
    ?>
    </body>
    </html>
     
    Last edited:

    Gihanlasita

    Member
    May 21, 2007
    392
    3
    0
    not that. the Form which contains html form
    you only post the script which create email and send.
    need to check the html form where user put name,email,phone and message and submit
     

    melanxpress

    Well-known member
  • Aug 18, 2008
    4,819
    223
    63
    32
    Malaysia & Kandy
    not that. the Form which contains html form
    you only post the script which create email and send.
    need to check the html form where user put name,email,phone and message and submit

    <form id="formMail" name="formMail" method="post" action="contactForm.php">

    <p><span id="sprytextfield1">
    <label for="name" class="phoneContact" style="margin-right:31px">お名前(かな)</label>
    <input type="text" name="name" id="name" class="formInput" />
    <span class="textfieldRequiredMsg">*</span></span></p>
    <p><span id="sprytextfield2">
    <label for="mail" class="phoneContact" style="margin-right:72px">メール</label>
    <input type="text" name="email" id="mail" class="formInput" />
    <span class="textfieldRequiredMsg">*</span></span></p>
    <p><span id="sprytextfield3">
    <label for="phone" class="phoneContact" style="margin-right:52px">電話番号</label>
    <input type="text" name="phone" id="phone" style="width:160px"/>
    <span class="textfieldRequiredMsg">*</span></span></p>
    <span id="sprytextarea1">
    <label for="message" class="phoneContact" style="position:relative">メッセージ</label><textarea name="message" id="message" cols="45" rows="5" class="contactMsg"></textarea>
    </span>

    <button type="submit" name="submit" style="padding-left:149px" id="submin" value="submit" class="contactSubmit"><img src="images/contactGo.png"/>
    </button></form>


    and here is the link

    www.anaenterprises.info/web/contact.html :)
     

    Gihanlasita

    Member
    May 21, 2007
    392
    3
    0
    htmlentities() is the function causing problems
    $name=htmlentities($_POST['name']);
    $email=htmlentities($_POST['email']);
    $phone=htmlentities($_POST['phone']);
    $message=htmlentities($_POST['message']);

    change it like this and it works

    $name=$_POST['name'];
    $email=$_POST['email'];
    $phone=$_POST['phone'];
    $message=$_POST['message'];
     
    • Like
    Reactions: melanxpress

    melanxpress

    Well-known member
  • Aug 18, 2008
    4,819
    223
    63
    32
    Malaysia & Kandy
    තව පොඩි හෙල්ප් එකක් ඕනේ :)
    මම දැන් ඒ දැම්මේ Contact Page එකේ PHP එක. එකේ ඔක්කොම හරියටම වැඩ කරනවා :)
    තව FORMs 4ක් තියෙනවා. ඒවගෙත් වෙනස් කරා. ඒවත් වැඩ හරියටම..

    මට තියෙන ප්‍රශ්නේ මෙකයි :) Contact Page එකේ Mail එකේ FROM එකට Senderගේ Name එක එනවා. එත් අනික් ඒවගේ එන්නේ නැනේ.එන්නේ Unknown Sender කියලා .:( මොකද්ද වෙනස් වෙන්න ඕනේ කියලා කියන්න පුලුවන්ද?

    8651623393_8372245842_b.jpg


    මෙන්න Contact eke PHP eka

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />


    <title>Email Form</title>
    </head>

    <body>
    <?php
    $name=$_POST['name'];
    $email=$_POST['email'];
    $phone=$_POST['phone'];
    $message=$_POST['message'];



    // you can specify which email you want your contact form to be emailed to here

    $toemail = "[email protected]";
    $subject = "Ana Enterprises - Contact Form";

    $headers = "MIME-Version: 1.0\n"
    ."From: \"".$name."\" <".$email.">\n"
    ."Content-type: text/html; charset=UTF-8";

    $body =


    "Name: ".$name."<br>\n"
    ."Email: ".$email."<br>\n"
    ."Phone: ".$phone."<br>\n"
    ."Message: ".$message."<br>\n";




    mail($toemail, $subject, $body, $headers);
    echo "<script type='text/javascript'>
    <!--
    window.location = 'thankyou.html'
    //-->
    </script>";

    ?>
    </body>
    </html>



    මෙන්න හරියට වැඩ කරන්නේ නැති එකක PHP එක

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />


    <title>Email Form</title>
    </head>

    <body>
    <?php
    $value01=$_POST['value01'];
    $value02=$_POST['value02'];
    $value03=$_POST['value03'];
    $value04=$_POST['value04'];
    $value05=$_POST['value05'];
    $last=$_POST['last'];
    $value07=$_POST['value07'];
    $comment=$_POST['comment'];


    // you can specify which email you want your contact form to be emailed to here

    $toemail = "[email protected]";
    $subject = "Ana Enterprises - Buy Car";

    $headers = "MIME-Version: 1.0\n"
    ."From: \"".$name."\" <".$email.">\n"
    ."Content-type: text/html; charset=iso-8859-1\n";

    $body =


    "Manufacture: ".$value01."<br>\n"
    ."Model: ".$value02."<br>\n"
    ."Year: ".$value03."<br>\n"
    ."Mileage: ".$value04."<br>\n"
    ."First Name: ".$value05."<br>\n"
    ."Last Name: ".$last."<br>\n"
    ."Phone: ".$value07."<br>\n"
    ."Comment: ".$comment."<br>\n";




    mail($toemail, $subject, $body, $headers);
    echo "<script type='text/javascript'>
    <!--
    window.location = 'thankyou.html'
    //-->
    </script>";

    ?>
    </body>
    </html>
     
    Last edited: