Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script language="JavaScript">
- <!--
- /***********************************************
- * Required field(s) validation v1.10- By NavSurf
- * Visit Nav Surf at http://navsurf.com
- * Visit http://www.dynamicdrive.com/ for full source code
- ***********************************************/
- function formCheck(formobj){
- // Enter name of mandatory fields
- var fieldRequired = Array("name", "email", "tel", "address", "country");
- // Enter field description to appear in the dialog box
- var fieldDescription = Array("Name", "Email", "Telephone", "Address", "Country");
- // dialog message
- var alertMsg = "Please complete the following fields:\n";
- var l_Msg = alertMsg.length;
- for (var i = 0; i < fieldRequired.length; i++){
- var obj = formobj.elements[fieldRequired[i]];
- if (obj){
- switch(obj.type){
- case "select-one":
- if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
- alertMsg += " - " + fieldDescription[i] + "\n";
- }
- break;
- case "select-multiple":
- if (obj.selectedIndex == -1){
- alertMsg += " - " + fieldDescription[i] + "\n";
- }
- break;
- case "text":
- case "textarea":
- if (obj.value == "" || obj.value == null){
- alertMsg += " - " + fieldDescription[i] + "\n";
- }
- break;
- default:
- }
- if (obj.type == undefined){
- var blnchecked = false;
- for (var j = 0; j < obj.length; j++){
- if (obj[j].checked){
- blnchecked = true;
- }
- }
- if (!blnchecked){
- alertMsg += " - " + fieldDescription[i] + "\n";
- }
- }
- }
- }
- if (alertMsg.length == l_Msg){
- return true;
- }else{
- alert(alertMsg);
- return false;
- }
- }
- // -->
- </script>
- <script>
- function quoteme() {
- $("#msgbox_body").html('<div id="contactform" style="margin-left:20px;margin-right:20px;margin-top:10px;"><form class="form" onsubmit="return formCheck(this);" method="POST" action="http://www.dtrmedical.com"><table border="0"><tbody><tr><td><p class="name"><label for="name">Your Name<span style="color:red;">*</span>:</label></p></td><td> </td><td><input type="text" name="name" id="name" /></td></tr><tr><td><p class="hospital"><label for="hospital">Hospital/Institution:</label></p></td><td> </td><td><input type="text" name="hospital" id="hospital" /></td></tr><tr><td><p class="department"><label for="department">Department:</label></p></td><td> </td><td><input type="text" name="department" id="department" /></td></tr><tr><td><p class="address"><label for="address">Address<span style="color:red;">*</span>:</label></p></td><td> </td><td><input type="text" name="address" id="address" /></td></tr><tr><td><p class="country"><label for="country">Country<span style="color:red;">*</span>:</label></p></td><td> </td><td><input type="text" name="country" id="country" /></td></tr><tr><td><p class="email"><label for="email">E-mail<span style="color:red;">*</span>:</label></p></td><td> </td><td><input type="text" name="email" id="email" /></td></tr><tr><td><p class="tel"><label for="tel">Telephone<span style="color:red;">*</span>:</label></p></td><td> </td><td><input type="text" name="tel" id="tel" /></td></tr><tr><td colspan="3" align="center"><p class="submit"><input style=\"margin-left:27px;cursor:pointer;\" onClick="jQuery.facebox({ ajax: (\'wishlist.php?emailme=true&name=\' + this.form.name.value + \'&country=\' + this.form.country.value + \'&email=\' + this.form.email.value + \'&address=\' + this.form.address.value + \'&tel=\' + this.form.tel.value + \'&hospital=\' + this.form.hospital.value + \'&department=\' + this.form.department.value) }); return false;" type="submit" value="Send enquiry" name="submit" /></p></td><td> </td><td> </td></tr></tbody></table></form></div>');
- $("#msgbox_actions").html('<input onclick="jQuery.facebox({ ajax: \'wishlist.php?basket=true\' })" type="button" value="Back to Wishlist" />');
- }
- </script>
- <? if (!$listempty) { ?>
- <div id="msgbox_actions"><input onclick="quoteme()" type="button" value="Request quote/sample" /> <a class="backtoproducts" href="http://www.dtrmedical.com/products" style="border-bottom-left-radius:5px 5px;border-bottom-right-radius:5px 5px;border-bottom-style:none;border-color:initial;border-left-style:none;border-right-style:none;border-top-left-radius:5px 5px;border-top-right-radius:5px 5px;border-top-style:none;border-width:initial;color:white;font-family:Arial;padding-bottom:2px;padding-left:6px;padding-right:6px;padding-top:2px;font-size:11px;">Back to products</a></div><!-- <input type="submit" value="Update" /> --><!-- <input onclick="jQuery.facebox({ ajax: 'wishlist.php?emailme=true' })" type="button" value="Save list for later" /> --> <!-- <input type="submit" value="Update Qty's" /> <input onclick="jQuery.facebox({ ajax: 'wishlist.php?basket=true&clearall=true' })" type="button" value="Clear list" /> -->
- <? } ?>
- </form>
- <? } //REMOVED </div> just before here ?>
- <?php
- // if send email
- if(isset($_GET['emailme']) && $_GET['emailme'] == 'true') {
- // to and subject
- $to = "[email protected]";
- $subject = "DTR Medical website - Product enquiry";
- // get these from query string
- $name_field = $_GET['name'];
- $hospital_field = $_GET['hospital'];
- $address_field = $_GET['address'];
- $country_field = $_GET['country'];
- $department_field = $_GET['department'];
- $email_field = $_GET['email'];
- $tel_field = $_GET['tel'];
- // get wishlist
- $query = "SELECT w.*, p.product_name, q.quantity_name, o.product_code, o.description
- FROM wishlistbasket w, products p, product_quantities q, product_options o
- WHERE sesid = '$sesid' AND w.pid = p.id AND w.qid = q.id AND w.oid = o.id ORDER BY w.pid, w.qid, w.oid";
- $res = mysql_query($query);
- $wish_list = '';
- if($res){
- while($row = mysql_fetch_assoc($res)) {
- if ($row['qty'] == 1) {
- $row['qty'] = "Quote";
- } else if ($row['qty'] == 2) {
- $row['qty'] = "Sample";
- } else if ($row['qty'] == 3) {
- $row['qty'] = "Quote and Sample";
- }
- $wish_list .= $row['product_code'] . ' - ' . $row['product_name'] . ', ' . $row['quantity_name'] . ', ' . $row['qty'] . '' . $row['product_options'] . "
- \n";
- }
- }
- // build mail body
- $body = "DTR Medical,\n\n
- You have an enquiry from the website, please see the details below:\n\n
- Name: $name_field\n
- Hospital/institution: $hospital_field\n
- Department: $department_field\n
- Address: $address_field\n
- Country: $country_field\n
- E-Mail: $email_field\n
- Tel: $tel_field\n
- Wishlist:\n $wish_list";
- mail($to, $subject, $body);
- echo "<div style=\"margin:20px;\">Thank you for your enquiry. We will be in touch within 48 hours.<br /> <br />If you would like to get in touch regarding your enquiry then please call us on:<br /> +44 (0) 1792 79 79 10<br /><br /><div onclick=\"location.href='/products\" style=\"margin-left:135px;cursor: pointer; margin-top: 10px; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; border-bottom-right-radius: 5px 5px; border-bottom-left-radius: 5px 5px; background-color:#663399; width: 143px; height: 30px;\"><a style=\" color:white;display:block;float:right;height:26px;margin-top:4px;padding-left:0px;padding-top:5px;width:120px;\" href=\"/products\" class=\"basket\">Back to products</a></div></div>";}
- ?>
Advertisement
Add Comment
Please, Sign In to add comment