Formular
Scris: Joi Apr 15, 2010
Va salut!
Am facut acest formular cu cod gasit pe net:
<form action="rezervari.php" method="post" name="form1" class="formular">
Tip camera <select name='ams[Tip camera]' id="textfield">
<option>single</option>
<option>double</option>
<option>tripla</option>
</select><br /><br />
Numar camere <input name='ams[Numar camere]' type="text" class="textfield" /><br /><br />
Numar persoane <input name='ams[Numar persoane]' type="text" class="textfield" /><br /><br />
Data sosirii <select name='ams[Ziua sosirii]' id="textfield">
<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>
<select name='ams[Luna sosirii]' id="textfield">
<option>Ianuarie</option><option>Februarie</option><option>Martie</option><option>Aprilie</option><option>Mai</option><option>Iunie</option><option>Iulie</option><option>August</option><option>Septembrie</option><option>Octombrie</option><option>Noiembrie</option><option>Decembrie</option>
</select>
<select name='ams[Anul sosirii]' id="textfield">
<option>2010</option><option>2011</option>
</select><br /><br />
Data plecarii <select name='ams[Ziua plecarii]' id="textfield">
<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>
<select name='ams[Luna plecarii]' id="textfield">
<option>Ianuarie</option><option>Februarie</option><option>Martie</option><option>Aprilie</option><option>Mai</option><option>Iunie</option><option>Iulie</option><option>August</option><option>Septembrie</option><option>Octombrie</option><option>Noiembrie</option><option>Decembrie</option>
</select>
<select name='ams[Anul plecarii]' id="textfield">
<option>2010</option><option>2011</option>
</select><br /><br />
Nume <input name='ams[Nume]' type="text" class="textfield" /><br /><br />
Prenume <input name='ams[Prenume]' type="text" class="textfield" /><br /><br />
Telefon <input name='ams[Tel]' type="text" class="textfield" /><br /><br />
Email <input name='ams[E-mail]' type="text" class="textfield" /><br /><br />
<input name="Submit2" type="reset" value="Anuleaza" class="input" />
<input name="Submit" type="submit" value="Trimite" class="input" />
</form>
rezervari.php:
<?
//----------------- Destinatia mesajului si Subiectul acestuia
$to = ""; //am sters adresa de mail
$subject = "Formular rezervari online";
$from = $_POST['ams']['E-mail'];
//----------------- preiau datele si creez mesajul
$valid=1;
$message ='';
foreach ($_POST['ams'] as $k=>$v){
if (trim($v)=='')$valid=0;
$k = str_replace('_',' ',$k);
$message .="$k : $v<br>";
}
$message .="<hr />IP: {$_SERVER['REMOTE_ADDR']}";
// faza asta cu ip-ul am adaugat`o pentru a putea avea si ip-ul celui care are chef
//de glume si trimite mail-uri aiurea. Big Grin
//------------------ Functia mail cu HTML support
function sndmail($from,$to,$subject,$message){
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From:".$from ."\r\n";
mail($to, $subject, $message, $headers);
}
//------------------ Trimit Mailul
if ($valid=='1') {
sndmail($from,$to,$subject,$message);
//------------------ Afisez mesaj de confirmare
echo "Am trimis mail";
}
//------------------ Afisez mesaj de eroare
else echo "EROARE";
?>
Trimite datele la adresa de mail dorita!
Am incercat sa il fac ca acest formular : https://marplo.net/php-mysql/formular_contact" target="_blank
Nu ma descurc.
Ma poate ajuta cineva?
Am facut acest formular cu cod gasit pe net:
<form action="rezervari.php" method="post" name="form1" class="formular">
Tip camera <select name='ams[Tip camera]' id="textfield">
<option>single</option>
<option>double</option>
<option>tripla</option>
</select><br /><br />
Numar camere <input name='ams[Numar camere]' type="text" class="textfield" /><br /><br />
Numar persoane <input name='ams[Numar persoane]' type="text" class="textfield" /><br /><br />
Data sosirii <select name='ams[Ziua sosirii]' id="textfield">
<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>
<select name='ams[Luna sosirii]' id="textfield">
<option>Ianuarie</option><option>Februarie</option><option>Martie</option><option>Aprilie</option><option>Mai</option><option>Iunie</option><option>Iulie</option><option>August</option><option>Septembrie</option><option>Octombrie</option><option>Noiembrie</option><option>Decembrie</option>
</select>
<select name='ams[Anul sosirii]' id="textfield">
<option>2010</option><option>2011</option>
</select><br /><br />
Data plecarii <select name='ams[Ziua plecarii]' id="textfield">
<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>
<select name='ams[Luna plecarii]' id="textfield">
<option>Ianuarie</option><option>Februarie</option><option>Martie</option><option>Aprilie</option><option>Mai</option><option>Iunie</option><option>Iulie</option><option>August</option><option>Septembrie</option><option>Octombrie</option><option>Noiembrie</option><option>Decembrie</option>
</select>
<select name='ams[Anul plecarii]' id="textfield">
<option>2010</option><option>2011</option>
</select><br /><br />
Nume <input name='ams[Nume]' type="text" class="textfield" /><br /><br />
Prenume <input name='ams[Prenume]' type="text" class="textfield" /><br /><br />
Telefon <input name='ams[Tel]' type="text" class="textfield" /><br /><br />
Email <input name='ams[E-mail]' type="text" class="textfield" /><br /><br />
<input name="Submit2" type="reset" value="Anuleaza" class="input" />
<input name="Submit" type="submit" value="Trimite" class="input" />
</form>
rezervari.php:
<?
//----------------- Destinatia mesajului si Subiectul acestuia
$to = ""; //am sters adresa de mail
$subject = "Formular rezervari online";
$from = $_POST['ams']['E-mail'];
//----------------- preiau datele si creez mesajul
$valid=1;
$message ='';
foreach ($_POST['ams'] as $k=>$v){
if (trim($v)=='')$valid=0;
$k = str_replace('_',' ',$k);
$message .="$k : $v<br>";
}
$message .="<hr />IP: {$_SERVER['REMOTE_ADDR']}";
// faza asta cu ip-ul am adaugat`o pentru a putea avea si ip-ul celui care are chef
//de glume si trimite mail-uri aiurea. Big Grin
//------------------ Functia mail cu HTML support
function sndmail($from,$to,$subject,$message){
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From:".$from ."\r\n";
mail($to, $subject, $message, $headers);
}
//------------------ Trimit Mailul
if ($valid=='1') {
sndmail($from,$to,$subject,$message);
//------------------ Afisez mesaj de confirmare
echo "Am trimis mail";
}
//------------------ Afisez mesaj de eroare
else echo "EROARE";
?>
Trimite datele la adresa de mail dorita!
Am incercat sa il fac ca acest formular : https://marplo.net/php-mysql/formular_contact" target="_blank
Nu ma descurc.
Ma poate ajuta cineva?