无法使用select2与表单发布到另一个页面

时间:2013-10-01 18:00:04

标签: javascript php jquery jquery-select2

我试图让这个工作,但我很难过有人可以帮我弄清楚我做错了什么?

调试器说没有错误。我不能让其他形式上班。我正试图从我的jsfiddle获取表单以发布到另一页进行存储。

这是我试图发布/存储数据的php文件。

<pre>
<!DOCTYPE html>
<html>

  <title>Please Sign In</title>

<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script type='text/javascript' src='http://code.jquery.com/jquery-1.8.3.js'></script>
<link rel="stylesheet" type="text/css" href="/css/normalize.css">
<link rel="stylesheet" type="text/css" href="/index.css">
<link rel="stylesheet" type="text/css" href="/css/result-light.css">
<script type='text/javascript' src="http://ivaynberg.github.com/select2/select2-master/select2.js"></script>
<link rel="stylesheet" type="text/css" href="http://ivaynberg.github.com/select2/select2-master/select2.css">
<link type="text/css" rel="stylesheet" href="css/styles/form.css?v3.1.1414"/>    


  <style type='text/css'>
    .selectContainer {
    margin: 20px;
    padding: 200px;
    }
    .form-label{
        width:1500px !important;
    }
    .form-label-left{
        width:1500px !important;
    }
    .form-line{
        padding-top:20px;
        padding-bottom:20px;
    }
    .form-label-right{
        width:1500px !important;
    }
    .form-all{
        width:1500px;
        background:#800080;
        color:#000000 !important;
        font-family:'Courier New';
        font-size:45px;
    }
</style>

<script src="js/prototype.js?v=3.1.1586" type="text/javascript"></script>
<script src="js/json2.js?v=3.1.1586" type="text/javascript"></script>
<script src="js/protoplus.js?v=3.1.1586" type="text/javascript"></script>
<script src="js/protoplus-ui.js?v=3.1.1586" type="text/javascript"></script>
<script src="js/jotform.js?v=3.1.1586" type="text/javascript"></script>
<script src="js/calendarview.js?v=3.1.1586" type="text/javascript"></script>
<script type="text/javascript">
   JotForm.init(function(){
      JotForm.setCalendar("7", false);
      JotForm.displayLocalTime("hour_7", "min_7", "ampm_7");
      $('input_42').hint('ex: myname@example.com');
      $('input_19').hint('01/01');
   });
</script>

<form class="jotform-form" name="input" action="www.vumiche.com/clients/clients.php" method="post" name="Signinform">
<script type='text/javascript'>
    $(function(){
        $('#e1').select2({
            data: [ {id:0, text:'Haircut Woman'}, {id:1, text:'Haircut Men'}, {id:2, text:'Haircut Children'}, {id:3, text:'Hair Trim Bang or Neck'}, {id:4, text:'Hair Coloring'}, 
                    {id:5, text:'Tinting Semi/Permanent'}, {id:6, text:'Full Weave'}, {id:7, text:'Cap Frost'}, {id:8, text:'Partial Highlights/Lowlights'}, {id:9, text:'Single Foil'}, 
                    {id:10, text:'Color Gloss'}, {id:11, text:'Color Remove'}, {id:12, text:'Color Corrective'}, {id:13, text:'Reconstruction'}, {id:14, text:'Hair Styling'}, 
                    {id:15, text:'Shampoo and Style'}, {id:16, text:'Updo'}, {id:17, text:'Wedding Updo'}, {id:18, text:'Straightening'}, {id:19, text:'Deep Conditiong'}, 
                    {id:20, text:'Hair Texture'}, {id:21, text:'Inventive Perms'}, {id:21, text:'Body Waves'}, {id:22, text:'Hair Straightening'}, {id:23, text:'Chemical Straightening'}, 
                    {id:24, text:'Japanese Straightening'}, {id:25, text:'Karatin Blowout'}, {id:26, text:'Karatin Treatment'}, {id:27, text:'Hair Extension '}, 
                    {id:1, text:'Hair Extension Weaving'}, {id:2, text:'Single Hair Extension'}, {id:28, text:'Feather Hair Extension'}, {id:29, text:'Sparkle Extension'}],
            multiple: true
        });

        $('#e2').select2({
            data: [ {id:1, text:'Gel Manicure'}, {id:1, text:'Gel Pedicure'}, {id:2, text:'Manicure'}, {id:3, text:'Sea Salt Manicure'}, {id:3, text:'Deluxe Manicure'}, 
                    {id:3, text:'Reflexology Manicure'}, {id:3, text:'Express Pedicure'}, {id:3, text:'Spa Pedicure'}, {id:3, text:'Spa Pedicure w/Sea Salt'}, 
                    {id:3, text:'Deluxe Spa Pedicure'}, {id:3, text:'Detox Foot Spa'}
                    ],
            multiple: true
        }); 

        $('#e3').select2({
            data: [ {id:0, text:'Gel Full Set'}, {id:1, text:'Gel Fill'}, {id:2, text:'Gel Color'}, {id:3, text:'Silk Full Set'}, {id:3, text:'Silk Fill'}, 
                    {id:3, text:'Acrylic Full Set'}, {id:3, text:'Acrylic Fill'}, {id:3, text:'Solar Full Set'}, {id:3, text:'Solar Fill'}, {id:3, text:'Solar Pink & White Fill'}, 
                    {id:3, text:'Paraffin Wax'}, {id:3, text:'Nail Art'}, {id:3, text:'3D Nail Art'}, {id:3, text:'French'}, {id:3, text:'Hand Polish Change'}
                    ],
            multiple: true
        });


        $('#e4').select2({
            data: [ {id:0, text:'Derm Renew Facial'}, {id:1, text:'Thermo Plastic Facial'}, {id:2, text:'Algomask +Cooling Thermo'}, {id:3, text:'Corrective Mask Facial'}, 
                    {id:3, text:'Collagen 90'}, {id:3, text:'Sea C Spa'}, {id:1, text:'Botinol “Botox like Effect”'}, {id:2, text:'Micro-Dermabrasion Treatment'}, 
                    {id:3, text:'Home Facial'}, {id:3, text:'European Facial'}, {id:3, text:'Dark Eye Circle & Puffiness'}, {id:3, text:'Acne Treatment Facial'}, 
                    {id:3, text:'Chemical Peel Treatment'}, {id:3, text:'Skin Tags, Brown Spot'}, {id:3, text:'Freckle, Mole Removal'}
                    ],
            multiple: true
        });

        $('#e5').select2({
            data: [ {id:0, text:'Eyebrow'}, {id:1, text:'Lip'}, {id:2, text:'Chin'}, {id:3, text:'Freckle, Mole Removal'}, {id:3, text:'Face'}, {id:3, text:'Half Legs'}, 
                    {id:3, text:'Full Legs'}, {id:3, text:'Under Arms'}, {id:3, text:'Half Arms'}, {id:3, text:'Full Arms'}, {id:3, text:'Bikini'}, {id:3, text:'Brazilian'}, 
                    {id:3, text:'Stomach'}, {id:3, text:'Back'}, {id:3, text:'Shoulder'}, {id:3, text:'Neck'}, {id:3, text:'Neck'}
                    ],
            multiple: true
        });

        $('#e6').select2({
            data: [ {id:0, text:'Body Bronzing'}, {id:1, text:'Full Legs Bronzing'}, {id:2, text:'Sparkle Extension'}
            ],
            multiple: true
        });

        $('#e7').select2({
            data: [ {id:0, text:'Bridal Make-Up'}, {id:1, text:'Make-Up Application'}, {id:2, text:'Lash or Brow Tinting'}, {id:3, text:'Eye Lash Perm'}, 
                    {id:3, text:'Flare Eye Lash Extension'}, {id:3, text:'Single Lash Extension'}, {id:3, text:'Airbrush Make-Up'}
                    ],
            multiple: true
        });

        $('#e8').select2({
            data: [{id:0, text:'30 Minutes'}, {id:1, text:'60 Minutes'}, {id:2, text:'90'}],
            multiple: true
        });

        $('#e9').select2({
            data: [{id:2, text:'15 Minutes'}, {id:0, text:'30 Minutes'}, {id:1, text:'60 Minutes'}, {id:2, text:'90 Minutes'}],
            multiple: true
        });

        $('#e10').select2({
            data: [{id:0, text:'1 Session'}, {id:1, text:'3 or More Sessions'}, {id:2, text:'6 or More Session'}],
            multiple: true
        });

        $('#e11').select2({
            data: [{id:0, text:'1 Session'}, {id:1, text:'3 or More Sessions'}, {id:2, text:'6 or More Session'}],
            multiple: true
        });

        $('#e12').select2({
            data: [ {id:0, text:'Eyebrow'}, {id:1, text:'Eyebrow Hair Stroke'}, {id:2, text:'Eye Liner'}, {id:3, text:'Eye Liner Upper & Lower'}, 
                    {id:4, text:'Lip Liner'}, {id:5, text:'FUll Lip'}, {id:6, text:'COrrective'}
                    ],
            multiple: true
        });


    });

</script>

</form>

</head>


<body>


<?php
  if($_POST['formSubmit'] == "Submit")
  {
    $clients.php = $_POST['www.vumiche.com/clients/clients.php'];
  }
?>

<input type="hidden" name="formID" value="32276820656155" />
  <div class="form-all">
    <ul class="form-section">
      <li id="cid_1" class="form-input-wide">
        <div class="form-header-group">
          <h1 id="header_1" class="form-header">
            Please sign in.
          </h1>
        </div>
      </li>
      <li class="form-line form-line-column form-line-column-clear" id="id_3">
        <label class="form-label-top" id="label_3" for="input_3">
          First Name<span class="form-required">*</span>
        </label>
        <div id="cid_3" class="form-input-wide">
          <input type="text" class=" form-textbox validate[required]" data-type="input-textbox" id="input_3" name="q3_firstName" size="110" value="" maxlength="50" />
        </div>
      </li>
      <li class="form-line form-line-column" id="id_4">
        <label class="form-label-top" id="label_4" for="input_4">
          Last Name<span class="form-required">*</span>
        </label>
        <div id="cid_4" class="form-input-wide">
          <input type="text" class=" form-textbox validate[required]" data-type="input-textbox" id="input_4" name="q4_lastName4" size="110" value="" maxlength="50" />
        </div>
      </li>
      <li class="form-line form-line-column" id="id_6">
        <label class="form-label-top" id="label_6" for="input_6">
          Phone Number<span class="form-required">*</span>
        </label>
        <div id="cid_6" class="form-input-wide"><span class="form-sub-label-container"><input class="form-textbox validate[required]" type="tel" name="q6_phoneNumber[area]" id="input_6_area" size="3">
            -
            <label class="form-sub-label" for="input_6_area" id="sublabel_area"> 

Area Code </label></span><span class="form-sub-label-container"><input class="form-textbox validate[required]" type="tel" name="q6_phoneNumber[phone]" id="input_6_phone" size="8">
            <label class="form-sub-label" for="input_6_phone" id="sublabel_phone"> 

Phone Number </label></span>
        </div>
      </li>
      <li class="form-line form-line-column" id="id_7">
        <label class="form-label-top" id="label_7" for="input_7">
          Date<span class="form-required">*</span>
        </label>
        <div id="cid_7" class="form-input-wide"><span class="form-sub-label-container"><input class="form-textbox validate[required]" id="month_7" name="q7_date7[month]" type="tel" size="2" maxlength="2" value="09" /><span class="date-separate">&nbsp;/</span>
            <label class="form-sub-label" for="month_7" id="sublabel_month"> Month 

</label></span><span class="form-sub-label-container"><input class="form-textbox validate[required]" id="day_7" name="q7_date7[day]" type="tel" size="2" maxlength="2" value="30" /><span class="date-separate">&nbsp;/</span>
            <label class="form-sub-label" for="day_7" id="sublabel_day"> Day 

</label></span><span class="form-sub-label-container">

<input class="form-textbox validate[required]" id="year_7" name="q7_date7[year]" type="tel" size="4" maxlength="4" value="2013" />
            <label class="form-sub-label" for="year_7" id="sublabel_year"> Year 

</label></span><span style='white-space: nowrap;'><span class="form-sub-label-container"><div id="at_7">
                at
              </div>

  <div class="selectContainer">
    <p>
        <label for="e1">Hair Service</label>
        <input name="hair" width="25" type="text" id="e1" placeholder="Select all that apply" />
    </p>
    <br/>
    <p>
        <label for="e2">Nails Service</label>
        <input name="nails" width="25" type="text" id="e2" placeholder="Select all that apply" />
    </p>
    <br/>
    <p>
        <label for="e3">Specialized Nails</label>
        <input name="Special" width="25" type="text" id="e3" placeholder="Select all that apply" />
    </p>
     <BR>
     <p>
        <label for="e4">Skin Care</label>
        <input name="Skin" width="25" type="text" id="e4" placeholder="Select all that apply" />
    </p>
         <BR>
     <p>
        <label for="e5">Face & Body Waxing</label>
        <input name="Waxing" width="25" type="text" id="e5" placeholder="Select all that apply" />
    </p>
         <BR>
     <p>
        <label for="e6">Body Bronzing</label>
        <input name="Bronzing" width="25" type="text" id="e6" placeholder="Select all that apply" />
    </p>
    <p>
        <label for="e7">Cosmetic</label>
        <input name="Cosmetic" width="25" type="text" id="e7" placeholder="Select all that apply" />
    </p>
    <br/>
    <p>
        <label for="e8">Massage</label>
        <input name="Massage" width="25" type="text" id="e8" placeholder="Select all that apply" />
    </p>
    <br/>
    <p>
        <label for="e9">Slimming & Toning Stomach Treatment</label>
        <input name="Slimming" width="25" type="text" id="e9" placeholder="Select all that apply" />
    </p>
     <BR>
     <p>
        <label for="e10">Body Wrap</label>
        <input name="Wrap" width="25" type="text" id="e10" placeholder="Select all that apply" />
    </p>
         <BR>
     <p>
        <label for="e11">Double Chin</label>
        <input name="Chin" width="25" type="text" id="e11" placeholder="Select all that apply" />
    </p>
         <BR>
     <p>
        <label for="e12">Permanent Make-Up Tattooing</label>
        <input name="Tattooing" width="25" type="text" id="e12" placeholder="Select all that apply" />
    </p>
    <br/>
</div>

</body>


</html>

</pre>

这是一个关于页面如何显示http://jsfiddle.net/slow503/5sHe7/embedded/result/

的方法

2 个答案:

答案 0 :(得分:0)

您似乎正在使用jQuery和Prototypejs,这会在您的脚本中产生冲突。请检查thisthis以忽略冲突。

试试这个:

<pre>
<!DOCTYPE html>
<html>

  <title>Please Sign In</title>

<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script type='text/javascript' src='http://code.jquery.com/jquery-1.8.3.js'></script>
<script>
jQuery.noConflict(); // change#1 
</script>
<link rel="stylesheet" type="text/css" href="/css/normalize.css">
<link rel="stylesheet" type="text/css" href="/index.css">
<link rel="stylesheet" type="text/css" href="/css/result-light.css">
<script type='text/javascript' src="http://ivaynberg.github.com/select2/select2-master/select2.js"></script>
<link rel="stylesheet" type="text/css" href="http://ivaynberg.github.com/select2/select2-master/select2.css">
<link type="text/css" rel="stylesheet" href="css/styles/form.css?v3.1.1414"/>    


  <style type='text/css'>
    .selectContainer {
    margin: 20px;
    padding: 200px;
    }
    .form-label{
        width:1500px !important;
    }
    .form-label-left{
        width:1500px !important;
    }
    .form-line{
        padding-top:20px;
        padding-bottom:20px;
    }
    .form-label-right{
        width:1500px !important;
    }
    .form-all{
        width:1500px;
        background:#800080;
        color:#000000 !important;
        font-family:'Courier New';
        font-size:45px;
    }
</style>

<script src="js/prototype.js?v=3.1.1586" type="text/javascript"></script>
<script src="js/json2.js?v=3.1.1586" type="text/javascript"></script>
<script src="js/protoplus.js?v=3.1.1586" type="text/javascript"></script>
<script src="js/protoplus-ui.js?v=3.1.1586" type="text/javascript"></script>
<script src="js/jotform.js?v=3.1.1586" type="text/javascript"></script>
<script src="js/calendarview.js?v=3.1.1586" type="text/javascript"></script>
<script type="text/javascript">
   JotForm.init(function(){
      JotForm.setCalendar("7", false);
      JotForm.displayLocalTime("hour_7", "min_7", "ampm_7");
      $('input_42').hint('ex: myname@example.com');
      $('input_19').hint('01/01');
   });
</script>

<form class="jotform-form" name="input" action="www.vumiche.com/clients/clients.php" method="post" name="Signinform">
<script type='text/javascript'>
// change 2 replace $ with jQuery in following code
    jQuery(function(){
        jQuery('#e1').select2({
            data: [ {id:0, text:'Haircut Woman'}, {id:1, text:'Haircut Men'}, {id:2, text:'Haircut Children'}, {id:3, text:'Hair Trim Bang or Neck'}, {id:4, text:'Hair Coloring'}, 
                    {id:5, text:'Tinting Semi/Permanent'}, {id:6, text:'Full Weave'}, {id:7, text:'Cap Frost'}, {id:8, text:'Partial Highlights/Lowlights'}, {id:9, text:'Single Foil'}, 
                    {id:10, text:'Color Gloss'}, {id:11, text:'Color Remove'}, {id:12, text:'Color Corrective'}, {id:13, text:'Reconstruction'}, {id:14, text:'Hair Styling'}, 
                    {id:15, text:'Shampoo and Style'}, {id:16, text:'Updo'}, {id:17, text:'Wedding Updo'}, {id:18, text:'Straightening'}, {id:19, text:'Deep Conditiong'}, 
                    {id:20, text:'Hair Texture'}, {id:21, text:'Inventive Perms'}, {id:21, text:'Body Waves'}, {id:22, text:'Hair Straightening'}, {id:23, text:'Chemical Straightening'}, 
                    {id:24, text:'Japanese Straightening'}, {id:25, text:'Karatin Blowout'}, {id:26, text:'Karatin Treatment'}, {id:27, text:'Hair Extension '}, 
                    {id:1, text:'Hair Extension Weaving'}, {id:2, text:'Single Hair Extension'}, {id:28, text:'Feather Hair Extension'}, {id:29, text:'Sparkle Extension'}],
            multiple: true
        });

        jQuery('#e2').select2({
            data: [ {id:1, text:'Gel Manicure'}, {id:1, text:'Gel Pedicure'}, {id:2, text:'Manicure'}, {id:3, text:'Sea Salt Manicure'}, {id:3, text:'Deluxe Manicure'}, 
                    {id:3, text:'Reflexology Manicure'}, {id:3, text:'Express Pedicure'}, {id:3, text:'Spa Pedicure'}, {id:3, text:'Spa Pedicure w/Sea Salt'}, 
                    {id:3, text:'Deluxe Spa Pedicure'}, {id:3, text:'Detox Foot Spa'}
                    ],
            multiple: true
        }); 

        jQuery('#e3').select2({
            data: [ {id:0, text:'Gel Full Set'}, {id:1, text:'Gel Fill'}, {id:2, text:'Gel Color'}, {id:3, text:'Silk Full Set'}, {id:3, text:'Silk Fill'}, 
                    {id:3, text:'Acrylic Full Set'}, {id:3, text:'Acrylic Fill'}, {id:3, text:'Solar Full Set'}, {id:3, text:'Solar Fill'}, {id:3, text:'Solar Pink & White Fill'}, 
                    {id:3, text:'Paraffin Wax'}, {id:3, text:'Nail Art'}, {id:3, text:'3D Nail Art'}, {id:3, text:'French'}, {id:3, text:'Hand Polish Change'}
                    ],
            multiple: true
        });


        jQuery('#e4').select2({
            data: [ {id:0, text:'Derm Renew Facial'}, {id:1, text:'Thermo Plastic Facial'}, {id:2, text:'Algomask +Cooling Thermo'}, {id:3, text:'Corrective Mask Facial'}, 
                    {id:3, text:'Collagen 90'}, {id:3, text:'Sea C Spa'}, {id:1, text:'Botinol Ԃotox like Effectԧ}, {id:2, text:'Micro-Dermabrasion Treatment'}, 
                    {id:3, text:'Home Facial'}, {id:3, text:'European Facial'}, {id:3, text:'Dark Eye Circle & Puffiness'}, {id:3, text:'Acne Treatment Facial'}, 
                    {id:3, text:'Chemical Peel Treatment'}, {id:3, text:'Skin Tags, Brown Spot'}, {id:3, text:'Freckle, Mole Removal'}
                    ],
            multiple: true
        });

        jQuery('#e5').select2({
            data: [ {id:0, text:'Eyebrow'}, {id:1, text:'Lip'}, {id:2, text:'Chin'}, {id:3, text:'Freckle, Mole Removal'}, {id:3, text:'Face'}, {id:3, text:'Half Legs'}, 
                    {id:3, text:'Full Legs'}, {id:3, text:'Under Arms'}, {id:3, text:'Half Arms'}, {id:3, text:'Full Arms'}, {id:3, text:'Bikini'}, {id:3, text:'Brazilian'}, 
                    {id:3, text:'Stomach'}, {id:3, text:'Back'}, {id:3, text:'Shoulder'}, {id:3, text:'Neck'}, {id:3, text:'Neck'}
                    ],
            multiple: true
        });

        jQuery('#e6').select2({
            data: [ {id:0, text:'Body Bronzing'}, {id:1, text:'Full Legs Bronzing'}, {id:2, text:'Sparkle Extension'}
            ],
            multiple: true
        });

        jQuery('#e7').select2({
            data: [ {id:0, text:'Bridal Make-Up'}, {id:1, text:'Make-Up Application'}, {id:2, text:'Lash or Brow Tinting'}, {id:3, text:'Eye Lash Perm'}, 
                    {id:3, text:'Flare Eye Lash Extension'}, {id:3, text:'Single Lash Extension'}, {id:3, text:'Airbrush Make-Up'}
                    ],
            multiple: true
        });

        jQuery('#e8').select2({
            data: [{id:0, text:'30 Minutes'}, {id:1, text:'60 Minutes'}, {id:2, text:'90'}],
            multiple: true
        });

        jQuery('#e9').select2({
            data: [{id:2, text:'15 Minutes'}, {id:0, text:'30 Minutes'}, {id:1, text:'60 Minutes'}, {id:2, text:'90 Minutes'}],
            multiple: true
        });

        jQuery('#e10').select2({
            data: [{id:0, text:'1 Session'}, {id:1, text:'3 or More Sessions'}, {id:2, text:'6 or More Session'}],
            multiple: true
        });

        jQuery('#e11').select2({
            data: [{id:0, text:'1 Session'}, {id:1, text:'3 or More Sessions'}, {id:2, text:'6 or More Session'}],
            multiple: true
        });

        jQuery('#e12').select2({
            data: [ {id:0, text:'Eyebrow'}, {id:1, text:'Eyebrow Hair Stroke'}, {id:2, text:'Eye Liner'}, {id:3, text:'Eye Liner Upper & Lower'}, 
                    {id:4, text:'Lip Liner'}, {id:5, text:'FUll Lip'}, {id:6, text:'COrrective'}
                    ],
            multiple: true
        });


    });

</script>

答案 1 :(得分:0)

javascript / jQuery周围有<form>个标签。这些标签需要围绕HTML标记。

<form>标记移动到标记中,包含将包含在表单中的name=属性的所有元素。