Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if( isset($_POST['name']) )
- {
- //$to = 'eshop@optiplaza.ro'; // Replace with your email
- $to = $_POST['budget'].',eshop@optiplaza.ro';
- $subject = 'Programare servicii'; // Replace with your subject if you need
- $message = 'Nume: ' . $_POST['name'] . "n" .
- 'Prenume: ' . $_POST['company']. "n" .
- 'E-mail: ' . $_POST['email']. "n" .
- 'Telefon: ' . $_POST['phone']. "nn" .
- 'Doresc: ' . $_POST['interested']. "n" .
- 'Magazin: ' . $_POST['budget']. "n" .
- 'Incepand cu: ' . $_POST['start']. "n" .
- 'Pana la: ' . $_POST['finish']. "n" .
- 'Observatii: ' . $_POST['comment']. "nnn";
- // Get a random 32 bit number.
- $num = md5(time());
- // Define the main headers.
- $headers = 'From:' . $_POST['name'] . "rn";
- $headers .= 'Reply-To:' . $_POST['email'] . "rn";
- $headers .= "MIME-Version: 1.0rn";
- $headers .= "Content-Type: multipart/mixed; ";
- $headers .= "boundary=$numrn";
- $headers .= "--$numrn";
- // Define the message section
- $headers .= "Content-Type: text/plainrn";
- $headers .= "Content-Transfer-Encoding:8bitrnn";
- $headers .= "$messagern";
- $headers .= "--$numrn";
- if( isset($_FILES['file']['tmp_name']) )
- {
- // Read the file into a variable
- $file = fopen($_FILES['file']['tmp_name'], 'r');
- $size = $_FILES['file']['size'];
- $content = fread($file, $size);
- $encoded_content = chunk_split(base64_encode($content));
- // Define the attachment section
- $headers .= "Content-Type: ". $_FILES['file']['type'] ."; ";
- $headers .= 'name="' . $_FILES['file']['name'] . '"' . "rn";
- $headers .= "Content-Transfer-Encoding: base64rn";
- $headers .= "Content-Disposition: attachment; ";
- $headers .= 'filename="' . $_FILES['file']['name'] . '"' . "rnn";
- $headers .= "$encoded_contentrn";
- $headers .= "--$num--";
- }
- // Send email
- mail($to, $subject, '', $headers);
- }
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <title>Programare servicii</title>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
- <link rel="stylesheet" href="css/demo.css">
- <link rel="stylesheet" href="css/font-awesome.css">
- <link rel="stylesheet" href="css/sky-forms.css">
- <link rel="stylesheet" href="css/sky-forms-red.css">
- <!--[if lt IE 9]>
- <link rel="stylesheet" href="css/sky-forms-ie8.css">
- <![endif]-->
- <script src="js/jquery.min.js"></script>
- <script src="js/jquery-ui.min.js"></script>
- <script src="js/jquery.form.min.js"></script>
- <script src="js/jquery.validate.min.js"></script>
- <!--[if lt IE 10]>
- <script src="js/jquery.placeholder.min.js"></script>
- <![endif]-->
- <!--[if lt IE 9]>
- <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
- <script src="js/sky-forms-ie8.js"></script>
- <![endif]-->
- </head>
- <body class="bg-red">
- <div class="body">
- <form action="programari.php" method="post" enctype="multipart/form-data" id="sky-form" class="sky-form">
- <header>Programare servicii:</header>
- <fieldset>
- <div class="row">
- <section class="col col-6">
- <label class="input">
- <i class="icon-append fa fa-user"></i>
- <input type="text" name="name" placeholder="Nume">
- </label>
- </section>
- <section class="col col-6">
- <label class="input">
- <i class="icon-append fa fa-user"></i>
- <input type="text" name="company" placeholder="Prenume">
- </label>
- </section>
- </div>
- <div class="row">
- <section class="col col-6">
- <label class="input">
- <i class="icon-append fa fa-envelope-o"></i>
- <input type="email" name="email" placeholder="E-mail">
- </label>
- </section>
- <section class="col col-6">
- <label class="input">
- <i class="icon-append fa fa-phone"></i>
- <input type="tel" name="phone" placeholder="Telefon">
- </label>
- </section>
- </div>
- </fieldset>
- <fieldset>
- <div class="row">
- <section class="col col-6">
- <label class="select">
- <select name="interested">
- <option value="none" selected disabled>Alege serviciul</option>
- <option value="Ochelari de vedere">Ochelari de vedere</option>
- <option value="Consult oftalmologic">Determinare dioptrii</option>
- <option value="Card smart">Card smart</option>
- </select>
- <i></i>
- </label>
- </section>
- <section class="col col-6">
- <label class="select">
- <select name="budget">
- <option value="" selected disabled>Alege magazinul</option>
- <option value="email@email.ro">Alba-Iulia-Mall Alba</option>
- <option value="email1@email.ro">Bucuresti-Centrul Comercial Orhideea</option>
- <option value="email2@email.ro">Bucuresti-Mall Vitan</option>
- <option value="email3@email.ro">Bucuresti-Baneasa Shopping City</option>
- <option value="email4@email.ro">Bucuresti-Centrul Comercial Esplanada</option>
- <option value="email5@email.ro">Bucuresti-Liberty Center</option>
- <option value="email6@email.ro">Bucuresti-AFI Palace Cotroceni</option>
- <option value="email7@email.ro">Centru Brasov</option>
- <option value="email8@email.ro">Coresi Brasov</option>
- <option value="email9@email.ro">Cluj-Polus Mall</option>
- <option value="email10@email.ro">Constanta-Centrul Comercial Tom</option>
- <option value="email11@email.ro">Iasi-Centrul Comercial Felicia</option>
- <option value="email12@email.ro">Iasi-Palas Mall</option>
- <option value="email13@email.ro">Valcea-River Plaza Mall</option>
- <option value="email14@email.ro">Pitesti-Jupiter City</option>
- <option value="email15@email.ro">Sibiu-Promenada Mall</option>
- <option value="email16@email.ro">Ploiesti-AFI Palace</option>
- </select>
- <i></i>
- </label>
- </section>
- </div>
- <div class="row">
- <section class="col col-6">
- <label class="input">
- <i class="icon-append fa fa-calendar"></i>
- <input type="text" name="start" id="start" placeholder="Incepand cu...">
- </label>
- </section>
- <section class="col col-6">
- <label class="input">
- <i class="icon-append fa fa-calendar"></i>
- <input type="text" name="finish" id="finish" placeholder="Pana la...">
- </label>
- </section>
- </div>
- <section>
- <label for="file" class="input input-file">
- <div class="button"><input type="file" name="file" multiple onchange="this.parentNode.nextSibling.value = this.value">Cauta</div><input type="text" placeholder="Reteta. Doar daca aveti." readonly>
- </label>
- </section>
- <section>
- <label class="textarea">
- <i class="icon-append fa fa-comment"></i>
- <textarea rows="5" name="comment" placeholder="Observatii..."></textarea>
- </label>
- </section>
- </fieldset>
- <footer>
- <button type="submit" class="button">Trimite</button>
- <div class="progress"></div>
- <!-- <h5 style="color:red">Vei fi contactat de catre colegii din magazinul ales</h5>-->
- </footer>
- <div class="message">
- <i class="fa fa-check"></i>
- <p>Multumim!<br>Un consultant o sa va contacteze in cel mai scurt timp posibil.</p>
- </div>
- </form>
- </div>
- <script type="text/javascript">
- $(function()
- {
- // Datepickers
- $('#start').datepicker({
- dateFormat: 'dd.mm.yy',
- prevText: '<i class="fa fa-chevron-left"></i>',
- nextText: '<i class="fa fa-chevron-right"></i>',
- onSelect: function( selectedDate )
- {
- $('#finish').datepicker('option', 'minDate', selectedDate);
- }
- });
- $('#finish').datepicker({
- dateFormat: 'dd.mm.yy',
- prevText: '<i class="fa fa-chevron-left"></i>',
- nextText: '<i class="fa fa-chevron-right"></i>',
- onSelect: function( selectedDate )
- {
- $('#start').datepicker('option', 'maxDate', selectedDate);
- }
- });
- // Validation
- $("#sky-form").validate(
- {
- // Rules for form validation
- rules:
- {
- name:
- {
- required: true
- },
- email:
- {
- required: true,
- email: true
- },
- phone:
- {
- required: true
- },
- interested:
- {
- required: true
- },
- budget:
- {
- required: true
- }
- },
- // Messages for form validation
- messages:
- {
- name:
- {
- required: 'Introduceti numele'
- },
- email:
- {
- required: 'Introduceti adresa de E-mail',
- email: 'Introduceti o adresa de email valida'
- },
- phone:
- {
- required: 'Introduceti numarul de Telefon'
- },
- interested:
- {
- required: 'Va rugam selectati serviciile dorite'
- },
- budget:
- {
- required: 'Va rugam selectati magazinul'
- }
- },
- // Ajax form submition
- submitHandler: function(form)
- {
- $(form).ajaxSubmit(
- {
- beforeSend: function()
- {
- $('#sky-form button[type="submit"]').addClass('button-uploading').attr('disabled', true);
- },
- uploadProgress: function(event, position, total, percentComplete)
- {
- $("#sky-form .progress").text(percentComplete + '%');
- },
- success: function()
- {
- $("#sky-form").addClass('submited');
- $('#sky-form button[type="submit"]').removeClass('button-uploading').attr('disabled', false);
- }
- });
- },
- // Do not change code below
- errorPlacement: function(error, element)
- {
- error.insertAfter(element.parent());
- }
- });
- });
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement