[X] Choose Font Here

Creating a simple PHP contact form

contact

 

ဒီ POST ကေတာ့ PHP Based simple contact form တစ္ခု ဘယ္လို create လုပ္တယ္ဆိုတာကို

ရွင္းျပမွာ ျဖစ္ပါတယ္။ website ေတြမွာ ၾကည့္မယ္ဆိုရင္ Contact Us၊ Feedback တို႔စတဲ့ Site Admin

ကို ကိုယ္ေပးခ်င္တဲ့ Message ကိုေပးလို႔ ရတဲ့ Feature ေတြကိုေတြ႔ ရႏိုင္ပါတယ္။ အဲလိုမ်ိဳး

Feature ကိုဘယ္လုပ္ထားတယ္ ဆိုတာ General ေရးထားတာ ျဖစ္ပါတယ္။

 

 

အဓိကလိုတာကေတာ့ contact.php, send_contact.php ဆိုတဲ့ PHP ၂ files ပဲလိုပါတယ္။ ဒီ ပုံကေတာ့ contact.php ကို

Client Browser မွာျမင္ရမယ့္ ပုံျဖစ္ပါတယ္။

 

contact1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Submit ကို Click တာနဲ႔ ကိုယ္ေပး ခ်င္တဲ့ Message ကို email အေနနဲ send ေပးမွာ ျဖစ္ပါတယ္။

contact.php coding ျဖစ္ပါတယ္။

 

<table width="400" border="0" align="center" cellpadding="3" cellspacing="1">
<tr>
<td><strong>Contact Form </strong></td>
</tr>
</table>
<table width="400" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td><form name="form1" method="post" action="send_contact.php">
<table width="100%" border="0" cellspacing="1" cellpadding="3">
<tr>
<td width="16%">Subject</td>
<td width="2%">:</td>
<td width="82%"><input name="subject" type="text" id="subject" size="50"></td>
</tr>
<tr>
<td>Detail</td>
<td>:</td>
<td><textarea name="detail" cols="50" rows="4" id="detail"></textarea></td>
</tr>
<tr>
<td>Name</td>
<td>:</td>
<td><input name="name" type="text" id="name" size="50"></td>
</tr>
<tr>
<td>Email</td>
<td>:</td>
<td><input name="customer_mail" type="text" id="customer_mail" size="50"></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></td>


Form ကို Submit လုပ္တာနဲ႔ send_contact.php ကိုေခၚမွာ ျဖစ္ပါတယ္။


</tr>
</table>
</form>
</td>
</tr>
</table>

 


send_contact.php ကိုဆက္သြား ၾကရေအာင္

အရင္ဆုံး ေအာက္က ပုံေလးကိုၾကည့္လိုက္ပါ။ ဒီပုံကေတာ့ Form ကို Submit လုပ္လို႔ email send တဲ့အခါမွာ အသုံးျပဳတဲ့

mail() function မွာ လိုအပ္တဲ့ parameter ေတြကို Form ကေနဘယ္လို ယူတယ္ဆိုတာ ရွင္းျပထားတာ ျဖစ္ပါတယ္။

 

contact2

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

send_contact.php coding ျဖစ္ပါတယ္။

 

<?php
// Contact subject
$subject ="$subject";
// Details
$message="$detail";
// Mail of sender
$mail_from="$customer_mail";
// From
$header="from: $name <$mail_from>";
// Enter your email address
$to ='someone@somewhere.com';


receive လုပ္ခ်င္တဲ့ email ကိုထည့္ေပးရ မွာျဖစ္ပါတယ္။


$send_contact=mail($to,$subject,$message,$header);
// Check, if message sent to your email
// display message "We've recived your information"
if($send_contact){
echo "We've recived your contact information";
}
else {
echo "ERROR";
}
?>

 

ဒါေလာက္ဆိုရင္ PHP Based simple contact form ကို create လုပ္ၾကည့္လို႔ ရပါျပီ။

 

Ref: http://www.phpeasystep.com/phptu/8.html

 

တျခား PHP Post ေတြအားလုံး ကို ႏွစ္သက္ရာ ေရြးဖတ္ ခ်င္တယ္ဆိုရင္ ဒီ Link ေလးကို Click လိုက္ပါ။

 

 

 

Comments (9)
  • cm17  - Thank you !

    ကုိ zack က စာေတြကို ရွင္းရွင္း လင္းလင္းနဲ ႔ အလြယ္တကူ နားလည္ႏိုင ္ေအာင္ ေရးတတ္ပါေပ တယ္.... ခ်ီးက်ဴးပါ တယ္.....

  • admin  - Re: Thank you !

    ဟုတ္လို႔လ) 40;း cm17 ရယ္။ ကြၽန္ေတာ္ေ ရးရင္ ဖတ္တဲ့သူေတ ြ နားမွနားလည ္း ပါ့မလားဆို ျပီး ေတြးေနတာ။ ကြၽန္ေတာ္က အေရးအသား ညံ့လို႔ပါ။ ခုလို ေျပာေပးတာက ို Thank Million ပါေနာ္။

  • minn nyo  - Thanks for sharing!

    အခုလို share တဲ့အတြက္ေက ်းဇူးပါ

  • sandy  - ေက်းဇူး&

    အခုလုိေသေ) 26;ခ်ာခ်ာကို ရွင္းျပေပး ထားတဲ့အတြက ္ ေက်းဇူးတင္ ပါတယ္ရွင္ ညီမ က ဒီလုိ ကုိယ္တုိင္ မေရးခဲ့ဘူး ရွင့္ ရွိျပီးသား component ေတြကိုပဲယူ သံုးတာ မ်ားတယ္ ဟီးးး
    ညီမ က အခု company တခုမွာ Joomla နဲ့ ေရးေနတာပါရ ွင္
    ေသခ်ာစနစ္တ က်ေတာ့မသိပ ါဘူး ဒီလုိပဲေလွ ်ာက္စမ္းေလ ွ်ာက္ေမးေန ရတာပါပဲ အကုိရယ္..အဲƜ 4;ုိအေသးစိတƟ 3;ကအစ ေရးေပးထားေ တာ့ ဗဟုသုတေတြအ မ်ားျကီးရလ ုိ့ေက်းဇူး တင္ပါတယ္ရွ င္..
    comment ေတာ့ ေပးေလ့မရွိ ဘူး စိတ္ထဲမွာပ ဲ ေကာင္းလုိက ္တာ ေက်းဇူးတင္ လုိက္တာပဲ ျဖစ္သြားတတ ္တာ.(တျခားဆƞ 3;ိဒ္ေတြ၀င္Ɵ 5;ကည့္ေပမယ္Ɵ 1;)..အခု အကို့ေရးထာ းတဲ့ စာေလးေျကာင ့္ေရးခ်င္စ ိတ္ျဖစ္သြာ းလုိ့ေရးလု ိက္တာပါ
    *ကၽြန္ေတာ့္ ;ရဲ ့POST ေလးေတြကို ဖတ္ျပီး တစ္စံုတစ္ခ ု အက်ိဳးရွိျ ပီး၊ အေထာက္အကူျ ပဳခဲ့မယ္ဆိ ုရင္ေတာ့ ကၽြန္ေတာ္ ပင္ပန္းရၾက ိဳး နပ္ပါျပီဗ် ာ။ တစ္ခ်ိဳ ့POST ေတြမွာ ရွိတဲ့ Comment ေတြကေတာ့ ကၽြန္ေတာ့္ ကို ေရွ ့ဆက္ေလွ်ာက ္ဖို ့တြန္းအားေ တြျဖစ္ေစခဲ ့ပါတယ္။
    ဒါေၾကာင့္ ဒီစကားေလဟာ မွန္မယ္လို ့ထင&...

  • admin  - Re: sandy

    ေက်းဇူးေန) 40;္ ညီမ။ အကိုလည္း အစတုန္းက ညီမလိုပဲ သူမ်ား blog ေတြလိုက္ ဖတ္ရင္ comment ေရးရမွာ အရမ္းကို ပ်င္းပါတယ္ ။ ေနာက္ပိုင္ း ကိုယ္ပိုင္ Site ေလးလုပ္ျဖစ ္လာေတာ့မွ ကိုယ္ခ်င္း စာမိလာတယ္။ POST တစ္ခုေရးဖိ ု႔ သူတို႔ေတြရ ဲ႕ ေပးဆပ္လိုက ္ရတာေတြကို နားလည္လာမိ တယ္။ ခုေတာ့ ကိုယ္ၾကိဳက ္တဲ့ POST ေလးတစ္ခုကိ ု ဖတ္မိရင္ comment ကို ရေအာင္ေရးတ ယ္ဗ်ာ။ အဲဒီ comment ေလးကိုျမင္ ရင္ သူၾကည့္ႏူး မယ္ဆိုတာ စိတ္ထဲက သိေနလို႕ပါ ။ ကြၽန္ေတာ္အ ဖို႕ ကေတာ့ မအားတဲ့ၾကာ း ကေန အခ်ိန္လုျပ ီး ေရးထားတဲ့ POST ေလးေတြေအာက ္က comment ေတြကို ျမင္ရင္ အတိုင္းမသိ ဝမ္းသာမိပါ တယ္ဗ်ာ။

  • tulip  - ေက်းဇူးပါ

    အခုလုိနားလည္ေအာင္ရွင္းျပထားတဲ့အစ္ကို ့ကိုေက်းဇူးတင္ပါတယ္..
    နားလည္လြယ္လုိ ့အရမ္းလည္းအေထာက္အကူျဖစ္ပါတယ္..
    ဆက္ျပီးလည္းေလ့လာေနဦးမွာပါ...

  • Thein Htike Soe  - error လာတက္ေနတယ္ဗ်ာ

    ကို Zack ေရ ကြ်န္ေတာ့က်မွ ဒီလို error လာတက္ေနတယ္ဗ်ာ
    [Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xampp\htdocs\Php\send_contact.php on line 15
    ERROR]
    ဘယ္ေနရာကို config လုပ္ရမွန္းမသိလို.ရွင္းျပေပးပါဦး

    ကို ဇက္ရဲ.ပို.စ္ေတြကိုေန.တိုင္းေစာင့္ဖတ္ေနတယ္
    ေက်းဇူးပါ ကိုဇက္

  • admin  - Re: Thein Htike Soe

    Localhost ကေန Mail ပို႔ခ်င္ရင္ Mail Server Freeware တစ္ခုခုကို install လုပ္ရင္လုပ္
    မလုပ္ရင္ SMTP ေတြကို ျပင္ေပးဖို႔ လိုတယ္ အကိုေရ
    1) http://www.phpeasystep.com/phptu/23.html
    2) http://www.programmingfacts.com/send-email-localhostxampp-wamp/
    3) http://roshanbh.com.np/2007/12/sending-e-mail-from-localhost-in-php-in -windows-environment.html

  • Thein Htike Soe  - Thank

    ေက်းဇူးပဲ ကိုဇက္ေရ php.ini မွာသြားျပင္တာေတာ့ အဆင္မေျပေသးဘူး mail server ကို ကိုဇက္ေပးတဲ့လင့္က ေဒါင္းတာလည္း connection က်ေနလို.အဆင္မေျပေသးဘူး ဒီ lession ကို ေနာက္မွဘဲ try ေတာ့မယ္
    ေက်းဇူးပါ ကိုဇက္

Write comment
Your Contact Details:
Comment:
[b] [i] [u] [url] [quote] [code] [img]   
:D:angry::angry-red::evil::idea::love::x:no-comments::ooo::pirate::?::(
:sleep::););)):0
Security
Please input the anti-spam code that you can read in the image.

Login Form

Categories Table View

JoomlaWatch Stats 1.2.9 by Matej Koval

Facebook Share

Share on facebook

Accordion FAQ

mod_joomtouch

Version Iphone

Version Iphone by JoomTouch