| Извините, если не туда. Не знала уже, где написать имеется код формы на php <?php @session_start(); $mailto = 'mailto:info_kotuchenyi@mail.ru'; if ( isset( $_POST['sendMail'] ) ) { $name = $_POST['username']; $email = $_POST['mailfrom']; $tel = $_POST['tel']; $type_work = $_POST['type_work']; $predmet = $_POST['predmet']; $tema_work = $_POST['tema_work']; $time_work = $_POST['time_work']; $trebov = $_POST['trebov']; $_SESSION['sendMailForm']['name'] = $name; $_SESSION['sendMailForm']['email'] = $email; $_SESSION['sendMailForm']['tel'] = $tel; $_SESSION['sendMailForm']['type_work'] = $type_work; $_SESSION['sendMailForm']['predmet'] = $predmet; $_SESSION['sendMailForm']['tema_work'] = $tema_work; $_SESSION['sendMailForm']['time_work'] = $time_work; $_SESSION['sendMailForm']['trebov'] = $trebov; @header( 'Location: '.$_SERVER['PHP_SELF'] ); $filepath = array(); $filename = array(); for( $i = 0; $i < count($_FILES['file']); $i++) { if ( !empty( $_FILES['file']['tmp_name'][$i] ) and $_FILES['file']['error'][$i] == 0 ) { $filepath[] = $_FILES['file']['tmp_name'][$i]; $filename[] = $_FILES['file']['name'][$i]; } } $body = "Имя: ".$name."\r\n\r\n"; $body .= "e-mail: ".$email."\r\n\r\n"; $body .= "Телефон: ".$tel."\r\n\r\n"; $body .= "Тип работы: ".$type_work."\r\n\r\n"; $body .= "Предмет: ".$predmet."\r\n\r\n"; $body .= "Тема работы: ".$tema_work."\r\n\r\n"; $body .= "Срок выполнения: ".$time_work."\r\n\r\n"; $body .= "Особые требования:\r\n".$trebov; if ( send_mail($mailto, $body, $email, $filepath, $filename) ) $_SESSION['success'] = true; else $_SESSION['success'] = false; @header( 'Location: '.$_SERVER['PHP_SELF'] ); die(); } function send_mail($mailto, $body, $email, $filepath, $filename) { $subject = '=?windows-1251?B?'.base64_encode('Заполнена форма на сайте').'?='; $boundary = "--".md5(uniqid(time())); $headers = "From: ".strtoupper($_SERVER['SERVER_NAME'])." <".$email.">\r\n"; $headers .= "Return-path: <".$email.">\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .="Content-Type: multipart/mixed; boundary=\"".$boundary."\"\r\n"; $multipart = "--".$boundary."\r\n"; $multipart .= "Content-type: text/plain; charset=\"windows-1251\"\r\n"; $multipart .= "Content-Transfer-Encoding: quoted-printable\r\n\r\n"; $body = quoted_printable_encode( $body )."\r\n\r\n"; $multipart .= $body; $file = ''; $count = count( $filepath ); if ( $count > 0 ) { for ( $i = 0; $i < $count; $i++ ) { $fp = fopen($filepath[$i], "r"); if ( $fp ) { $content = fread($fp, filesize($filepath[$i])); fclose($fp); $file .= "--".$boundary."\r\n"; $file .= "Content-Type: application/octet-stream\r\n"; $file .= "Content-Transfer-Encoding: base64\r\n"; $file .= "Content-Disposition: attachment; filename=\"".$filename[$i]."\"\r\n\r\n"; $file .= chunk_split(base64_encode($content))."\r\n"; } } } $multipart .= $file."--".$boundary."--\r\n"; if( mail($mailto, $subject, $multipart, $headers) ) return true; else return false; } function quoted_printable_encode ( $string ) { $string = preg_replace_callback ( '/[^\x21-\x3C\x3E-\x7E\x09\x20]/', 'quoted_printable_encode_character', $string ); $newline = "=\r\n"; // '=' + CRLF (rule #4) $string = preg_replace ( '/(.{73}[^=]{0,3})/', '$1'.$newline, $string); return $string; } function quoted_printable_encode_character ( $matches ) { $character = $matches[0]; return sprintf ( '=%02x', ord ( $character ) ); } ?> <?php if ( isset( $_SESSION['success'] ) ) { if ( $_SESSION['success'] ) echo '<p>Письмо успешно отправлено</p>'; else echo '<p>Ошибка при отправке письма</p>'; unset( $_SESSION['success'] ); } ?> <form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="POST" enctype="multipart/form-data"> <table border="0" style="font-size: 12px;"> <tr> <td>Ваше имя:</td> <td> <input type="text" name="username" size="30" maxlength="20"></td> </tr> <tr> <td>Ваш E-mail:</td> <td><input type="text" name="mailfrom" size="30" maxlength="50"></td> </tr> <tr> <td>Телефон:</td> <td><input type="text" name="tel" size="30" maxlength="50"></td> </tr> <tr> <td>Тип работы:</td> <td><input type="text" name="type_work" size="30" maxlength="50"></td> </tr> <tr> <td>Предмет:</td> <td><input type="text" name="predmet" size="30" maxlength="50"></td> </tr> <tr> <td>Тема работы:</td> <td><input type="text" name="tema_work" size="30" maxlength="50"></td> </tr> <tr> <td>Срок выполнения:</td> <td><input type="text" name="time_work" size="30" maxlength="50"></td> </tr> <tr> <td>Особые требования:</td> <td><textarea cols="50" rows="10" name="trebov"></textarea></td> </tr> <tr> <td>Файл:</td> <td><input type="file" name="file[]" /></td> </tr> <tr> <td>Файл:</td> <td><input type="file" name="file[]" /></td> </tr> <tr> <td><input type="submit" name="sendMail" value="Отправить"></td> <td><input type="reset" value="Очистить"></td> </tr> </table> </form> в опере форма не работает вообще в чем дело? |