hi am new to php and i want to make an inquiry form with following fields. please help me.
Name :
Gender: male / female
Date Of Birth :
Place of birth :
Time:
Comments:
This is the php am using:
This is mark up and the css:<?
/*
Form to mail
*/
// ------------- CONFIGURABLE SECTION ------------------------
$mailto = 'youre-mail@gmail.com' ;
// the pages to be displayed, eg
//$formurl = "http://www.example.com/feedback.htm" ;
//$errorurl = "http://www.example.com/error.htm" ;
//$thankyouurl = "http://www.yoursite.com/feedback.htm" ;
$formurl = "http://www.yoursite.org/feedback.htm" ;
$errorurl = "http://www.yoursite.org/error.htm" ;
$thankyouurl = "http://www.yoursite.org/thankyou.htm" ;
// -------------------- END OF CONFIGURABLE SECTION ---------------
$name = $_POST['name'] ;
$lname = $_POST['lname'] ;
$email = $_POST['email'] ;
$city = $_POST['city'] ;
$country = $_POST['country'] ;
$comments = $_POST['comments'] ;
$http_referrer = getenv( "HTTP_REFERER" );
$subject = $name." Feedback" ;
if (!isset($_POST['email'])) {
header( "Location: $formurl" );
exit ;
}
if (empty($name) || empty($email) || empty($comments)) {
header( "Location: $errorurl" );
exit ;
}
if (get_magic_quotes_gpc()) {
$comments = stripslashes( $comments );
}
$messageproper =
"This message was sent from:
\n" . "$http_referrer\n\n\r" .
"------------------- COMMENTS ----From----------\n\n" .
"Name: ".$name."\r\n".
"Last Name: ".$lname."\r\n".
"Email: ".$email."\r\n".
"City: ".$city."\r\n".
"Country: ".$country."\r\n".
"Comments: ".$comments.
"\n\n------------------------------------------------------------\n" ;
mail($mailto, $subject, $messageproper, "From: \"$name\" <$email>\nReply-To: \"$name\" <$email>\nX-Mailer: chfeedback.php 2.03" );
mail($email,"Thank you for your comments","\r\nThank you for giving us your comments at yoursite.org\r\n\r\nRegars Admin\r\nwww.yoursite.org","From:Admin yoursite.org<yoursite@gmail.com>");
header( "Location: $thankyouurl" );
exit ;
?>
<form name="feedback" method="POST" action="feedback.php3" onSubmit="">
<input TYPE="hidden" NAME="VTI-GROUP" VALUE="0">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="30%"><div align="justify" class="maintext"><font face="Verdana" size="2">Name :</font></div></td>
<td width="70%"><div align="left">
<input name="name" type="text" class="textt" size="20">
</div></td>
</tr>
<tr>
<td width="30%"><div align="justify" class="maintext"><font face="Verdana" size="2">Gender :</font></div></td>
<td width="70%"><div align="left">
<label class="maintext">
<input type="radio" name="radio" id="r" value="r" />
Male</label>
<label>
<input type="radio" name="radio" id="r2" value="r2" />
<span class="maintext">Female</span></label>
</div></td>
</tr>
<tr>
<td width="30%"><div align="justify" class="maintext"><font face="Verdana" size="2">Date Of Birth:</font></div></td>
<td width="70%"><div align="left">
<label><span class="mainconttext">Month</span>
<select name="1r" size="1" id="1r">
<option selected="selected">January</option>
<option>February</option>
<option>March</option>
<option>April</option>
<option>May</option>
<option>June</option>
<option>July</option>
<option>August</option>
<option>September</option>
<option>October</option>
<option>November</option>
<option>December</option>
</select>
</label>
<label><span class="mainconttext">Date</span></label>
<span class="mainconttext">
<label> </label>
</span>
<label><select name="2r" size="1" id="2r">
<option>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>
<label><span class="mainconttext">Year
</span>
<select name="3r" size="1" id="3r">
<option>1986</option>
<option>1985</option>
<option>1984</option>
<option>1983</option>
<option>1982</option>
<option>1981</option>
<option>1980</option>
<option>1979</option>
<option>1978</option>
<option>1977</option>
<option>1976</option>
<option>1975</option>
<option>1974</option>
</select>
</label>
</div></td>
</tr>
<tr>
<td width="30%"><div align="justify" class="maintext"><font face="Verdana" size="2"> City / Country:</font></div></td>
<td width="70%"><div align="left">
<input name="city" type="text" class="textt" size="20">
</div></td>
</tr>
<tr>
<td width="30%"><div align="justify" class="maintext"><font face="Verdana" size="2">Time :</font></div></td>
<td width="70%"><div align="left">
<input name="country" type="text" class="textt" size="20">
</div></td>
</tr>
<tr>
<td width="30%"></td>
<td width="70%"></td>
</tr>
<tr>
<td width="30%"><div align="justify"><font face="Verdana" size="2"> <span class="maintext">Comments :</span></font></div></td>
<td width="70%"><div align="left">
<textarea name="comments" cols="30" rows="6" class="textt"></textarea>
</div></td>
</tr>
</table>
<p align="center">
<input type="submit" value="Submit" name="submit" onClick='return doCheck()'>
<input type="reset" value="Reset" name="B2">
</form>



Reply With Quote


Bookmarks