Jump to content
xisto Community
circlemodeling

How Can I Write PHP Code By This Formmail Html

Recommended Posts

purpose is i want the information in the web page sent into my email.

i just know that i need to use php script to operate this action ,but i have no idea about

this php code. so anyone can help me please...

thank you very much.

 

<div id="Layer12"><form action="???" method="post" enctype="multipart/form-data" name="form1" id="form1"><div id="Layer15"></div><label for="textfield"><br /><strong>ชื่อ</strong> </label><input name="name" type="text" class="style12" id="name" dir="ltr" lang="th" />.......................<div id="Layer13"></div><div id="Layer21"></div><div id="Layer22"></div>.......<strong>นามสกุล</strong><input name="surname" type="text" class="style12" id="label" lang="th" />....... <strong>ชื่อเล่น</strong><label for="label2"><strong></strong></label><input name="nickname" type="text" class="style12" id="label2" size="15" /><br /><label for="select"><strong><br />วันเกิด</strong> </label><select name="bd" size="1" id="bd"><option selected="selected">1</option><option>2</option><option>3</option><option>4</option><option>5</option><option>6</option><option>7</option><option>8</option><option>9</option><option>10</option><option>11</option><option>12</option><option>13</option><option>14</option><option>15</option><option>16</option><option>17</option><option>18</option><option>19</option><option>20</option><option>21</option><option>22</option><option>23</option><option>24</option><option>25</option><option>26</option><option>27</option><option>28</option><option>29</option><option>30</option><option>31</option></select><label for="label4">-</label><select name="bm" id="label4"><option selected="selected">Jan</option><option>Feb</option><option>Mar</option><option>Apr</option><option>May</option><option>Jun</option><option>Jul</option><option>Aug</option><option>Sep</option><option>Oct</option><option>Nov</option><option>Dec</option></select><label for="label5">-</label><select name="by" id="label5"><option selected="selected">1970</option><option>1971</option><option>1972</option><option>1973</option><option>1974</option><option>1975</option><option>1976</option><option>1977</option><option>1978</option><option>1979</option><option>1980</option><option>1981</option><option>1982</option><option>1983</option><option>1984</option><option>1985</option><option>1986</option><option>1987</option><option>1988</option><option>1989</option><option>1990</option><option>1991</option><option>1992</option><option>1993</option><option>1994</option><option>1995</option><option>1996</option></select>.................<label for="radiobutton"><strong> </strong></label><strong> เพศ </strong>----<input name="gender" type="radio" id="radiobutton" value="male" /><label for="radiobutton"><strong>ชาย</strong></label>-<input name="gender" type="radio" id="radio" value="female" checked="checked" /><strong>หญิง</strong> <div id="Layer16"></div><br /><label for="label6"><strong><br />น้ำหนัก</strong></label><input name="weight" type="text" id="label6" size="6" maxlength="4" />.........................................<label for="label7"><strong>ส่วนสูง</strong></label><input name="height" type="text" id="label7" size="6" maxlength="4" />....................<label for="label8"><strong>สัดส่วน</strong></label><select name="shape" id="label8"><option>25</option><option>26</option><option>27</option><option>28</option><option>29</option><option>30</option><option>31</option><option>32</option><option>33</option><option>34</option><option>35</option><option>36</option><option>37</option></select>-<select name="shape2" id="shape2"><option>22</option><option>23</option><option>24</option><option>25</option><option>26</option><option>27</option><option>28</option><option>29</option><option>30</option><option>31</option><option>32</option></select>-<label for="label9"></label><select name="shape3" id="label9"><option>25</option><option>26</option><option>27</option><option>28</option><option>29</option><option>30</option><option>31</option><option>32</option><option>33</option><option>34</option><option>35</option><option>36</option><option>37</option><option>38</option></select><br /><span class="style12"></span><div id="Layer19"></div><span class="style12"></span><div id="Layer20"></div><span class="style12"><label for="label10"><strong><br />ที่อยู่</strong></label></span><textarea name="address" cols="30" rows="2" class="style12" id="label10"></textarea>..........................<label for="label11"><strong>รหัสไปรษณีย์</strong></label><input name="postcode" type="text" id="label11" size="10" maxlength="6" /><br /><label for="label12"><strong><br />โทรศัพท์</strong></label><input type="text" name="tel" id="label12" />.............................................<label for="label13"><strong>มือถือ</strong></label><input type="text" name="mobile" id="label13" /><br /><label for="label14"><strong><br />E-mail.</strong></label><input name="email" type="text" id="label14" size="30" maxlength="40" /><br /><label for="file"> <strong><br /><br /><br /><br />รูปภาพครึ่งตัว..</strong></label><input type="file" name="file" id="file" /><br /><label for="label15"><strong><br />รูปภาพเต็มตัว</strong></label><input type="file" name="file2" id="label15" /><br /><label for="label16"><strong><br />เกี่ยวกับตัวฉันเอง</strong></label><textarea name="about" cols="50" rows="3" class="style12" id="label16"></textarea><br /><br /><br /><label for="Submit"></label><div align="center"><input type="submit" name="Submit" value="Submit" id="Submit" /></div><label for="label3"></label><div align="center"><input type="reset" name="reset" value="Reset form" id="label3" /><br /><input name="recipient" type="hidden" id="recipient" value="arr120@hotmail.com" /><input name="url" type="hidden" id="url" value="http://http://reseller.ijabry.com/; /></div></form></div>

Notice from miCRoSCoPiC^eaRthLinG:
Since you are new here, this is to inform you that whenever you paste large blocks of CODE in your posts, you MUST place them between CODE or CODEBOX tags. Otherwise your post will be considered as an attempt to earn extra hosting points and you will be penalized accordingly.

Share this post


Link to post
Share on other sites

there are many scripts that are already programed to do this for you, go to http://www.hotscripts.com/ and search in the archives of PHP to find some, with keywords: contact form, or similar.. Im sure you will find finished solutions that are ready to implement. Try to find some and with looking thru their code you will probably learn easier how it's done...

Share this post


Link to post
Share on other sites

Do you want the actualy html sent to your email, or the data that the user supplies. Anyway, you would use the php $_POST variable to collect all your data.

Example

$URL = $_POST['url']; //retrieves url from form

NOTE: Variables are case-sensitive in php.

 

You would then create script and link your form to that script once it's submitted. So where you have your

<form  action="???"
you would put

<form action="mail_results.php
or something along those lines, depending on what you name your script and where it's located on the server.

 

As far as mailing the results I suggest you look at the mail() function provided by php.

 

http://us3.php.net/manual/en/function.mail.php

 

To genereate the $message variable you would accumulate your variables one by one and append them to the $message variable;

 

Example:

//retrieving variables; placing into message$message = ''; // Empty string...why not?$message = "Name = " . $_POST['name'] . "\n";$message .= "BD = " . $_POST{'bd'] . "\n";

That would work. Notice you have to the double quotes for the \n to produce another line. You could probably enclose the $_POST variables inside the double quotes, and it would work, but I tend to put my variables seperate from the string.

A faster way but less customizable way of doing this is simple loop over all the variables sent and put them in your email.

Example

$message = '';//declare empty stringforeach($_POST as $key=>$value){	 $message .= $key . " = " . $value . "\n";}//!End of looping over post variables/* then use the mail function here */

Hope this is what you were looking for.

 

-Good Luck

Share this post


Link to post
Share on other sites

also take it mind if you want to send the email in text or html mode, if its in the second mode you need some extra information set to the mail function to work properly, and dont forget to review the mail() function in the php site as suggested by minnieadkins, you would save a lot of time, believe me. :-)best regards,

Share this post


Link to post
Share on other sites

also take it mind if you want to send the email in text or html mode, if its in the second mode you need some extra information set to the mail function to work properly, and dont forget to review the mail() function in the php site as suggested by minnieadkins, you would save a lot of time, believe me. :-)
best regards,

hi can form to mail in PHP script work on servers without SMTP support??

Share this post


Link to post
Share on other sites

hi can form to mail in PHP script work on servers without SMTP support??

Under any *nix system it works fine because it comes with this support, under windows you must configure it.
Best regards

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.