Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> dlaczego ten formularz nie wysyła meili
-Gość_piestrt-
post 22.01.2006, 21:06:29
Post #1





Goście







Witam mam taki formularz i nie wiem gdzie zrobilem bład po prostu nie wysyła meili


kod php

Kod php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<?php
include('../functions.php');
set_path('..');

include(
'session.php');

layout_begin();

$dajFormularz = true;
$adresat = "tomek@fajnie.com\";
$litery_male_pl = \"&plusmn;ćęłńó&para;Ľż\";
$litery_duze_pl = \"ˇĆŁŃÓ&brvbar;&not;Ż\";
$rozmiary = array( 'xxl', 'xl', 'l', 'm', 's', 'xs', 'xxs' );
$komunikat = \"\";
if( isset( $_POST['wysylamy'] ) )
{
    $dajFormularz = false;
    if( empty( $_POST['imieinazwisko'] ) )
    {
        $dajFormularz = true;
        $komunikat .= \"<b>Brak nazwy zamawiaj&plusmn;cego</b><br>\";
    }

    if( empty( $_POST['adres'] ) )
    {
        $dajFormularz = true;
        $komunikat .= \"<b>Brak adresu zamawiaj&plusmn;cego</b><br>\";
    }

    if( empty( $_POST['telefon'] ) )
    {
        $dajFormularz = true;
        $komunikat .= \"<b>Brak numeru telefonu</b><br>\";
    }

    $suma = 0;
    foreach( $rozmiary as $wartosc )
    {
        $suma += (int)$_POST['r'.$wartosc];
    }

    foreach( $rozmiary as $wartosc )
    {
        if( !is_numeric( $_POST['r'.$wartosc] ) )
        {
            $komunikat .= \"<b>Ilo&para;ć sztuk musi być liczb&plusmn;</b><br>\";
            break;
        }
    }

    if( !is_numeric( $_POST['ilosc'] ) )
    {
            $komunikat .= \"<b>Ilo&para;ć sztuk musi być liczb&plusmn;</b><br>\";
    }

    if( $suma != $_POST['ilosc'] )
    {
        $dajFormularz = true;
        $komunikat .= \"<b>Niezgodna ilo&para;ć sztuk z ilo&para;ci&plusmn; zamawianych zestawów</b><br>\";
    }
    
    if( empty( $_POST['email'] ) || !ereg(\"^[A-Z\".$GLOBALS['litery_duze_pl'].\"a-z\".$GLOBALS['litery_male_pl'].\"0-9._-]{1,}@[A-Z\".$GLOBALS['litery_duze_pl'].\"a-z\".$GLOBALS['litery_male_pl'].\"0-9_-]{1,}\.([A-Z\".$GLOBALS['litery_duze_pl'].\"a-z\".$GLOBALS['litery_male_pl'].\"0-9\_-]{1,}\.?){1,}$\", $_POST['email'] ) )
    {
        $dajFormularz = true;
        $komunikat .= \"<b>Niepoprawny adres email</b><br>\";
    }


    if( !empty( $komunikat ) )
    {
        $komunikat .= \"<br><br>\";
    }
    else //dane poprawne wysylami maila
    {
        if( $_POST['zestaw'] != '' )
        {
            if( $_POST['zestaw'] > 0 )
            $HIT = (($_POST['zestaw'] < 10)?\"0\":\"\").$_POST['zestaw'];
        }

        if( $_POST['radio1'] != '' )
        {
            $dodatek = \" \".$_POST['radio1'];
        }

        
        srand( ( double )microtime() * 1000000 ); 
        $marker = md5( uniqid( rand() ) );

        $naglowek = \"From: Sklep\n\";
        $naglowek .= \"Reply-to: \".$_POST['email'].\"\n\";
        $naglowek .= \"Content-Type: multipart/mixed; \";
        $naglowek .= \"boundary=\"\".$marker.\"\"\";
        $tresc = \"--\".$marker.\"\n\";
        $tresc .= \"Content-type: text/plain; charset=iso-8859-2\n\";
        $tresc .= \"Content-Transfer-Encoding: 8bit\n\";
        $tresc .= \"Content-Disposition: inline\n\";
        $tresc .= \"Zamawiana ilo&para;ć sztuk \".$_POST['ilosc'].\"\n\";
        $tresc .= \"Zestaw HIT\".$HIT.$dodatek.\" \n\";
        foreach( $rozmiary as $wartosc )
        {
            if( $_POST['r'.$wartosc] != '' )
            {
                $tresc .= \"Rozmiar \".strtoupper($wartosc).\" szt. \".$_POST['r'.$wartosc].\" numery \".$_POST['rn'.$wartosc].\"\n\";
            }
        }
        if( $_POST['bramkarz'] == \"TAK\" )
        {
            $tresc .= \"Dodatkowo zamówiony Komplet bramkarski\";
            if( $HTTP_POST_FILES['plik']['error'] == 0 ) $tresc .= \"z reklam&plusmn; na koszulce\";
            $tresc .= \"\n\";
        }

        $tresc .= \"\nDane zamawiaj&plusmn;cego\n\";
        $tresc .= \"Nazwa \".$_POST['imieinazwisko'].\"\n\";
        $tresc .= \"Adres \".$_POST['adres'].\"\n\";
        $tresc .= \"Nip \".$_POST['nip'].\"\n\";
        $tresc .= \"Regon/PESEL \".$_POST['regon'].\"\n\";
        $tresc .= \"Telefon \".$_POST['telefon'].\"\n\";
        $tresc .= \"email \".$_POST['email'].\"\n\";

        //tutaj ewentualny plik z reklam&plusmn;
        if( $HTTP_POST_FILES['plik']['error'] == 0 && $_POST['bramkarz'] == \"TAK\" ) 
        {
            $deskryptor = fopen( $HTTP_POST_FILES['plik']['tmp_name'], \"r\" );
            $plik = fread( $deskryptor, filesize( $HTTP_POST_FILES['plik']['tmp_name'] ) ); 
            fclose( $deskryptor );

            $tresc .= \"--\".$marker.\"\n\";
            $tresc .= \"Content-Type: \".$HTTP_POST_FILES['plik']['type'].\"; name=\"\".$HTTP_POST_FILES['plik']['name'].\"\"\n\";
            $tresc .= \"Content-Transfer-Encoding: base64\n\";
            $tresc .= \"Content-Description: \"Reklama na koszulkę\"\n\";
            $tresc .= chunk_split( base64_encode( $plik ) );
        }

        $tresc .= \"--\".$marker.\"--\";

        //echo \"_\".mail( $adresat, \"Zamówienie\", $tresc, $naglowek).\"_\";
        //echo \"<pre>\".$tresc.\"</pre>\";
        mail( $adresat, \"Zamówienie\", $tresc, $naglowek);
    }
}

if( $dajFormularz )
{
?>



a tak wyglada html


HTML
<form method="POST" enctype="multipart/form-data">
<table cellspacing="2" cellPadding="0" width="510" align="center" border="0"><tbody>
<tr><td align="middle" width="100%" class="detail"><font class="textblack"><?php echo $komunikat; ?><b>Szczegóły zamówienia</b></font></td></tr>
</tbody></table>

<table cellspacing="0" cellpadding="4" width="506" align="center" border="0"><tbody>
<tr><td align="middle" width="100%" class="detail"><p align="justify">

<table width="90%" align="center" border="0" cellspacing="2" cellPadding="0">
<tr valign="_top">
<td width="15%"> </td>
<td width="35%"> </td>
<td width="50%"> </td>
</tr>
<tr valign="_top">
<td colspan="2"><font class="textblack">&nbsp;Ilo&para;ć sztuk: <input type="text" class="deflog2" size="1" maxlength="2" name="ilosc" value="<?php echo $_POST['ilosc']; ?>"><br><br>

<table width="50" border="0">
<tr>
<td width="50%"><font class="textblack">Zestaw: </font></td>
<td width="50%">
<!-- <select name="urljump" class="deflog2" onchange="javascript: window.top.location.href=this.options[this.selectedIndex].value">-->
<select name="zestaw" class="deflog2">
<option value="0">HIT</OPTION>
<option value="1">HIT 01</OPTION>
<option value="2">HIT 02</OPTION>
<option value="3">HIT 03</OPTION>
<option value="4">HIT 04</OPTION>
<option value="5">HIT 05</OPTION>
<option value="6">HIT 06</OPTION>
<option value="7">HIT 07</OPTION>
<option value="8">HIT 08</OPTION>
<option value="9">HIT 09</OPTION>
<option value="10">HIT 10</OPTION>
<option value="11">HIT 11</OPTION>
<option value="12">HIT 12</OPTION>
<option value="13">HIT 13</OPTION>
<option value="14">HIT 14</OPTION>
</select>
</td>
</tr>
</table>
<br><br>
</font>
</td>
<td>
<!-- <FORM> -->
<INPUT TYPE="radio" NAME="radio1" VALUE="podstawowy"><font class="textblack"><b><i>HIT</i></b> podstawowy (62 zł brutto)</font></INPUT><br>
<INPUT TYPE="radio" NAME="radio1" VALUE="z numerem"><font class="textblack"><b><i>HIT</i></b> z numerem (69 zł brutto)</font></INPUT><br>
<INPUT TYPE="radio" NAME="radio1" VALUE="z reklam&plusmn;"><font class="textblack"><b><i>HIT</i></b> z reklam&plusmn; (80 zł brutto)</font></INPUT><br>
<!-- </FORM> -->
</td>
</tr>


<tr valign="center">
<td><font class="textblack"><b>XXL</b> - </font></td>
<td colspan="2"><font class="textblack">ilo&para;ć: <input type="text" class="deflog2" size="1" maxlength="2" name="rxxl" value="<?php echo $_POST['rxxl']; ?>">; numery - <input type="text" class="deflog2" size="20" maxlength="40" name="rnxxl" value="<?php echo $_POST['rnxxl']; ?>"></font></td>
</tr>
<tr valign="center">
<td><font class="textblack"><b>XL</b> - </font></td>
<td colspan="2"><font class="textblack">ilo&para;ć: <input type="text" class="deflog2" size="1" maxlength="2" name="rxl" value="<?php echo $_POST['rxl']; ?>">; numery - <input type="text" class="deflog2" size="20" maxlength="40" name="rnxl" value="<?php echo $_POST['rnxl']; ?>"></font></td>
</tr>
<tr valign="center">
<td><font class="textblack"><b>L</b> - </font></td>
<td colspan="2"><font class="textblack">ilo&para;ć: <input type="text" class="deflog2" size="1" maxlength="2" name="rl" value="<?php echo $_POST['rl']; ?>">; numery - <input type="text" class="deflog2" size="20" maxlength="40" name="rnl" value="<?php echo $_POST['rnl']; ?>"></font></td>
</tr>
<tr valign="center">
<td><font class="textblack"><b>M</b> - </font></td>
<td colspan="2"><font class="textblack">ilo&para;ć: <input type="text" class="deflog2" size="1" maxlength="2" name="rm" value="<?php echo $_POST['rm']; ?>">; numery - <input type="text" class="deflog2" size="20" maxlength="40" name="rnm" value="<?php echo $_POST['rnm']; ?>"></font></td>
</tr>
<tr valign="center">
<td><font class="textblack"><b>S</b> - </font></td>
<td colspan="2"><font class="textblack">ilo&para;ć: <input type="text" class="deflog2" size="1" maxlength="2" name="rs" value="<?php echo $_POST['rs']; ?>">; numery - <input type="text" class="deflog2" size="20" maxlength="40" name="rns" value="<?php echo $_POST['rns']; ?>"></font></td>
</tr>
<tr valign="center">
<td><font class="textblack"><b>XS</b> - </font></td>
<td colspan="2"><font class="textblack">ilo&para;ć: <input type="text" class="deflog2" size="1" maxlength="2" name="rxs" value="<?php echo $_POST['rxs']; ?>">; numery - <input type="text" class="deflog2" size="20" maxlength="40" name="rnxs" value="<?php echo $_POST['rnxs']; ?>"></font></td>
</tr>
<tr valign="center">
<td><font class="textblack"><b>XXS</b> - </font></td>
<td colspan="2"><font class="textblack">ilo&para;ć: <input type="text" class="deflog2" size="1" maxlength="2" name="rxxs" value="<?php echo $_POST['rxxs']; ?>">; numery - <input type="text" class="deflog2" size="20" maxlength="40" name="rnxxs" value="<?php echo $_POST['rnxxs']; ?>"></font></td>
</tr>
<tr valign="_top"><td colspan="3"><br></td></tr>

<tr valign="_top">
<td colspan="2"><font class="textblack"><b>Komplet bramkarski</b>:<br><INPUT TYPE="checkbox" NAME="bramkarz" VALUE="TAK">
Zamawiam (100 zł)</font></td>
<td><font class="textblack"><b>Reklama na koszulce</b> (opcjonalnie):<br><INPUT TYPE="file" NAME="plik"></font></td>
</tr>
</table>

</p></td></tr>
</tbody></table>

<br>

<table cellspacing="2" cellPadding="0" width="510" align="center" border="0"><tbody>
<tr><td align="middle" width="100%" class="detail"><
Go to the top of the page
+Quote Post
crash
post 22.01.2006, 21:13:16
Post #2





Grupa: Przyjaciele php.pl
Postów: 2 196
Pomógł: 2
Dołączył: 17.01.2004
Skąd: Sosnowiec

Ostrzeżenie: (0%)
-----


Sprawdź if()'em czy dochodzi w ogóle do wysłania maila.


--------------------
Go to the top of the page
+Quote Post
piestrt
post 23.01.2006, 21:47:28
Post #3





Grupa: Zarejestrowani
Postów: 18
Pomógł: 0
Dołączył: 11.01.2004
Skąd: Łódź

Ostrzeżenie: (0%)
-----


moze ktos wrzucic na serwer i u siebie sprawdzic, moze u mnie jakies ograniczenia sa czy jakies inne rzeczy.


Plis.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 

RSS Wersja Lo-Fi Aktualny czas: 18.07.2025 - 04:36