简体   繁体   English

jQuery不发送帖子变量?

[英]Jquery not sending Post variables?

Firstly I apologize, my knowledge of jquery is awful but Im learning. 首先,我很抱歉,我对jquery的了解很糟糕,但是我正在学习。 I have a major problem with a script Im writing for personal use, driving me up the wall all weekend. 我个人编写的脚本有一个主要问题,整个周末都把我推倒了。 The PHP works 100% (tested) its just the jquery that wont send the post variables PHP工作100%(测试),它只是不会发送post变量的jquery

The script allows you to add steps along with a picture and a caption, there is a button at the bottom which allows you to either 'remove last step' or 'add another step' limited to a maximum of 10 steps. 该脚本允许您添加步骤以及图片和标题,底部有一个按钮,您可以“删除最后一步”或“添加另一步骤”(最多10个步骤)。 When using it on a browser and viewing the html it works seamlessly, the name and id changes as required, it works great apart form the fact that after step1 none of the other steps (ie, step2 step3 step4) send the variables upon form submission. 当在浏览器上使用它并查看html时,它可以无缝运行,名称和ID根据需要进行更改,这与以下步骤非常有效:在步骤1之后,其他任何步骤(即,步骤2,步骤3,步骤4)都不会在提交表单后发送变量。 I am using method post for the form and below is the javascript and the html for the step adder: 我在表单中使用方法发布,下面是步骤添加器的javascript和html:

 <html>
<head>

    <link rel="stylesheet" href="style/css/screen.css">

    <script type="text/javascript" src="style/js/jquery-1.3.2.min.js"></script>
    <script type="text/javascript" src="style/js/jquery-ui-1.7.custom.min.js"></script> 

    <script type="text/javascript">
    $(document).ready(function(){

        var counter = 2;

        $("#addButton").click(function () {

        if(counter>10){
                alert("Only 10 steps allowed");
                return false;
        }   

        var newTextBoxDiv = $(document.createElement('div'))
             .attr("id", 'TextBoxDiv' + counter);

        newTextBoxDiv.after().html('<div style="margin-bottom:25px; height:180px;"><div class="form"><label>Step '+ counter + ': </label>' +
              '<div class="form"><input readonly="readonly" id="step'+ counter + '" type="hidden" name="step'+ counter + '" maxlength="92"size="50" value="step'+ counter + '"/><div class="formholder">Photo &nbsp; <input style="outline: 5px solid #f5f5f5;" type="file" class="file" name="pics' + counter + '"/></div></br>' +
              '<div style="margin-top:10px; margin-bottom:10px;" class="formholder">Title &nbsp; &nbsp; &nbsp;<input style="outline: 5px solid #f5f5f5; display:; width:330px;" id="rtitle' + counter + '" type="text" name="rtitle' + counter + '" maxlength="55" size="30"><br /></div></div>' +
              '<div class="formholder"><textarea style="outline: 5px solid #f5f5f5; display:block; width:370px; height:85px; padding:0; margin:0 auto; overflow:auto;" rows="3" cols="49" type="text" name="step' + counter + '" id="step' + counter + '" value="" ></textarea></div></div></div>');

        newTextBoxDiv.appendTo("#TextBoxesGroup");


        counter++;
         });

         $("#removeButton").click(function () {
        if(counter==1){
              alert("No more steps to remove");
              return false;
           }   

        counter--;

            $("#TextBoxDiv" + counter).remove();

         });

         $("#getButtonValue").click(function () {

        var msg = '';
        for(i=1; i<counter; i++){
          msg += "\n Step " + i + " : " + $('#step' + i).val();
        }
              alert(msg);
         });
      });
    </script>

    <script type="text/javascript">
    $(document).ready(function(){

        var counter = 2;

        $("#addButtoni").click(function () {

        if(counter>30){
                alert("Only 30 ingredients allowed");
                return false;
        }   

        var newTextBoxDiv = $(document.createElement('div'))
             .attr("id", 'TextBoxDivi' + counter);

        newTextBoxDiv.after().html('<div style="height: 75px;"><div class="form"><label>Ingredient '+ counter + ': </label>' +
              '<input style="outline: 5px solid #f5f5f5;" size="50" type="text" name="ingredient' + counter + 
              '" id="ingredient' + counter + '" value="" ></div>' +
              '<div class="form"><label><i>Amount:</i></label>' +
              '<input style="outline: 5px solid #f5f5f5;" type="text" id="amount' + counter + 
              '" name="amount' + counter + '" size="15" value="">&nbsp;' +
              ' <select style="outline: 5px solid #f5f5f5; border: 1px solid #A2B1C5; padding: 4px; margin-bottom: 4px;" name="unit' + counter + 
              '" id="unit' + counter + '">' +
              '<option value="g">g</option>' +
              '<option value="kg">kg</option>' +
              '<option value="lb">lb</option>' +
              '<option value="tsp">tsp</option>' +
              '<option value="tbsp">tbsp</option>' +
              '<option value="cup">cup</option>' +
              '<option value="pint">pint</option>' +
              '<option value="ml">ml</option>' +
              '<option value="l">l</option>' +
              '<option value="bunch">bunch</option>' +
              '<option value="pinch">pinch</option>' +
              '</select></div></div>');

        newTextBoxDiv.appendTo("#TextBoxesGroupi");


        counter++;
         });

         $("#removeButtoni").click(function () {
        if(counter==1){
              alert("No more ingredients to remove");
              return false;
           }   

        counter--;

            $("#TextBoxDivi" + counter).remove();

         });

         $("#getButtonValuei").click(function () {

        var msg = '';
        for(i=1; i<counter; i++){
          msg += "\n Ingredient " + i + " : " + $('#ingredient' + i).val();
        }
              alert(msg);
         });
      });
    </script>

    <script type="text/javascript">
        $(function() {

            var $tabs = $('#jrtabs').tabs();

            $(".ui-tabs-panel").each(function(i){

              var totalSize = $(".ui-tabs-panel").size() - 1;

              if (i != totalSize) {
                  next = i + 2;
                  $(this).append("<a href='#' class='next-tab mover' rel='" + next + "'>Next Step &#187;</a>");
              }

              if (i != 0) {
                  prev = i;
                  $(this).append("<a href='#' class='prev-tab mover' rel='" + prev + "'>&#171; Prev Step</a>");
              }

            });

            $('.next-tab, .prev-tab').click(function() { 
                   $tabs.tabs('select', $(this).attr("rel"));
                   return false;
               });


        });
    </script>
</head>
<body>
            <div id="jrtabs">

                <ul>
                    <li><a href="#fragment-1"><strong>1</strong>. Overview</a></li>
                    <li><a href="#fragment-2"><strong>2</strong>. Images</a></li>
                    <li><a href="#fragment-3"><strong>3</strong>. Ingredients</a></li>
                    <li><a href="#fragment-4"><strong>4</strong>. Steps</a></li>
                    <li><a href="#fragment-5"><strong>5</strong>. Dietary</a></li>
                    <li><a href="#fragment-6"><strong>6</strong>. Additional</a></li>
                </ul>





                    <div id="fragment-1" class="ui-tabs-panel">
                        <div>

                        <?php
                            if($_SESSION['id'])
                            {
                            $sql="SELECT * from `users` WHERE `id`='".$_SESSION['id']."'";
                            $res=mysql_query($sql);
                            $row=mysql_fetch_assoc($res);
                            if(!$_POST['update'])
                            {
                            ?>

                            <form enctype="multipart/form-data" action="recipes/addrecipe.php" method="POST">

                                <input readonly="readonly" id="r_id" type="hidden" name="r_id" maxlength="92"size="50" value="<?php $id_result = mysql_query("SELECT * FROM recipe"); $num_id = mysql_num_rows($id_result); $num_recipe = $num_id + 1; echo "$num_recipe";?>">

                                <div style="margin-bottom:10px;" class="form">
                                    <label for="title">Title</label>
                                    <input style="width:370px; outline: 5px solid #f5f5f5;" id="title" type="text" name="title" maxlength="92" size="50"><br/>
                                </div>

                                <div style="margin-bottom:10px;" class="form">
                                    <label for="description">Description</label>
                                    <textarea style="outline: 5px solid #f5f5f5; display:block; width:370px; height:85px; padding:0; margin:0 auto; overflow:auto;" type='text' id='description' name='description' rows="3" cols="49"></textarea><br/>
                                </div>

                                <div style="margin-bottom:10px;" class="form">
                                    <label for="time">Time</label>
                                    Prep &nbsp;<input style="outline: 5px solid #f5f5f5;" id="prep_time" type="text" name="prep_time" maxlength="4"size="4"> &nbsp;
                                    <select style="outline: 5px solid #f5f5f5; border: 1px solid #A2B1C5; padding: 4px; margin-bottom: 4px;" name="prep_time_unit" id="prep_time_unit">
                                    <option value="Hour">Hour</option>
                                    <option value="Hours">Hours</option>
                                    <option value="Minutes">Minutes</option>
                                    </select> 
                                    &nbsp&nbsp&nbsp Cook &nbsp;<input style="outline: 5px solid #f5f5f5;" id="cook_time" type="text" name="cook_time" maxlength="4"size="4"> &nbsp;
                                    <select style="outline: 5px solid #f5f5f5; border: 1px solid #A2B1C5; padding: 4px; margin-bottom: 4px;" name="cook_time_unit" id="cook_time_unit">
                                    <option value="Hour">Hour</option>
                                    <option value="Hours">Hours</option>
                                    <option value="Minutes">Minutes</option>
                                    </select>   
                                    <br/>
                                </div>

                                <div style="margin-bottom:10px;" class="form">
                                    <label for="date">Date</label>
                                    Day &nbsp;
                                    <select style="outline: 5px solid #f5f5f5; border: 1px solid #A2B1C5; padding: 4px; margin-bottom: 4px;" name="day" id="day">
                                        <option value="01">01</option>
                                        <option value="02">02</option>
                                        <option value="03">03</option>
                                        <option value="04">04</option>
                                        <option value="05">05</option>
                                        <option value="06">06</option>
                                        <option value="07">07</option>
                                        <option value="08">08</option>
                                        <option value="09">09</option>
                                        <option value="10">10</option>
                                        <option value="11">11</option>
                                        <option value="12">12</option>
                                        <option value="13">13</option>
                                        <option value="14">14</option>
                                        <option value="15">15</option>
                                        <option value="16">16</option>
                                        <option value="17">17</option>
                                        <option value="18">18</option>
                                        <option value="19">19</option>
                                        <option value="20">20</option>
                                        <option value="21">21</option>
                                        <option value="22">22</option>
                                        <option value="23">23</option>
                                        <option value="24">24</option>
                                        <option value="25">25</option>
                                        <option value="26">26</option>
                                        <option value="27">27</option>
                                        <option value="28">28</option>
                                        <option value="29">29</option>
                                        <option value="30">30</option>
                                        <option value="31">31</option>
                                    </select>
                                    &nbsp;&nbsp;Month &nbsp;
                                    <select style="outline: 5px solid #f5f5f5; border: 1px solid #A2B1C5; padding: 4px; margin-bottom: 4px;" name="month" id="month">
                                        <option value="01">January</option>
                                        <option value="02">Febuary</option>
                                        <option value="03">March</option>
                                        <option value="04">April</option>
                                        <option value="05">May</option>
                                        <option value="06">June</option>
                                        <option value="07">July</option>
                                        <option value="08">August</option>
                                        <option value="09">September</option>
                                        <option value="10">October</option>
                                        <option value="11">November</option>
                                        <option value="12">December</option>
                                    </select>
                                    &nbsp;&nbsp;Year &nbsp;
                                    <select style="outline: 5px solid #f5f5f5; border: 1px solid #A2B1C5; padding: 4px; margin-bottom: 4px;" name="year" id="year">
                                        <option value="2012">2012</option>
                                        <option value="2013">2013</option>
                                        <option value="2014">2014</option>
                                        <option value="2015">2015</option>
                                        <option value="2016">2016</option>
                                    </select>
                                    <br/>
                                </div>

                                <div style="margin-bottom:10px;" class="form">
                                    <label for="course">Course</label>
                                    <select style="outline: 5px solid #f5f5f5; border: 1px solid #A2B1C5; padding: 4px; margin-bottom: 4px;" name="course" id="course">
                                        <option value="01">01</option>
                                    </select>
                                </div>

                        </div>
                    </div>



                    <div id="fragment-2" class="ui-tabs-panel">
                        <div class="dividerlarge">

                            <div style="margin-bottom:10px;" class="form">

                                <label for="pics">Thumbnail:</label>

                                    <div class="formholder">
                                        Title &nbsp; &nbsp; &nbsp;<input style="outline: 5px solid #f5f5f5; display:; width:300px;" id="rtitle" type="text" name="rtitle" maxlength="55" size="30">
                                        <br />
                                        </div>
                                        <label for="pics"><i>150px x 150px</i></label>
                                        <div class="formholder">
                                        Photo &nbsp; <input style="outline: 5px solid #f5f5f5;" type="file" class="file" name="pics"/>
                                    </div>
                                    </br>
                            </div>
                            </br>

                            <div style="margin-bottom:10px;" class="form">
                                    <label for="videolink">Video Link</label>
                                    <textarea style="outline: 5px solid #f5f5f5; display:block; width:370px; height:85px; padding:0; margin:0 auto; overflow:auto;" type='text' id='videolink' name='videolink' rows="3" cols="49"></textarea><br/>
                            </div>

                        </div>
                    </div>




                    <div id="fragment-3" class="ui-tabs-panel">
                        <div class="dividerlarge">

                                <div id='TextBoxesGroupi'>
                                    <div style="height: 75px;" id="TextBoxDiv1i">

                                        <div class="form">
                                            <label>Ingredient 1: </label>
                                                <input style="outline: 5px solid #f5f5f5;" type='text' id='ingredient1' name='ingredient1' size="50">
                                        </div><br />
                                        <div class="form">
                                            <label><i>Amount:</i></label>
                                                <input style="outline: 5px solid #f5f5f5;" type='text' id='amount1' name='amount1' size="15">&nbsp;

                                            <select style="outline: 5px solid #f5f5f5; border: 1px solid #A2B1C5; padding: 4px; margin-bottom: 4px;" name="unit1" id="unit1">
                                                <option value="g">g</option>
                                                <option value="kg">kg</option>
                                                <option value="lb">lb</option>
                                                <option value="tsp">tsp</option>
                                                <option value="tbsp">tbsp</option>
                                                <option value="cup">cup</option>
                                                <option value="pint">pint</option>
                                                <option value="ml">ml</option>
                                                <option value="l">l</option>
                                                <option value="bunch">bunch</option>
                                                <option value="pinch">pinch</option>
                                            </select>
                                                <input type="text" name="Other" id="Other" style="display: none;">
                                    </div>
                                    </div>
                                </div>
                                <div style="float:left; width: 400px;">
                                    <input style="border: 1px solid #dddddd; background:#f5f5f5; margin-left:95px; font-weight:bold; color:#78AB46;" type='button' value='Click to add ingredient' id='addButtoni'>
                                    <input style="border: 1px solid #dddddd; background:#f5f5f5; font-weight:bold; color:#c16b54;" type='button' value='Click to remove last' id='removeButtoni'>
                                </div>

                        </div>
                    </div>





                    <div id="fragment-4" class="ui-tabs-panel">
                        <div class="dividerlarge">

                                <div id='TextBoxesGroup'>
                                    <div style="margin-bottom:25px; height:180px;" id="TextBoxDiv1">
                                        <div class="form">
                                            <label>Step 1: </label>
                                            <div class="form">


                                        <input readonly="readonly" id="step1" type="hidden" name="step1" maxlength="92"size="50" value="step1"/>

                                        <div class="formholder">
                                        Photo &nbsp; <input style="outline: 5px solid #f5f5f5;" type="file" class="file" name="pics"/>
                                    </div>
                                    </br>
                                    <div style="margin-top:10px; margin-bottom:10px;" class="formholder">
                                        Title &nbsp; &nbsp; &nbsp;
                                        <input style="outline: 5px solid #f5f5f5; display:; width:330px;" id="rtitle" type="text" name="rtitle" maxlength="55" size="30"/>
                                        <br />
                                        </div>
                            </div>

                            <div class="formholder">
                                            <textarea style="outline: 5px solid #f5f5f5; display:block; width:370px; height:85px; padding:0; margin:0 auto; overflow:auto;" type='text' id='step1' name='step1' rows="3" cols="49"></textarea>
                                            </div>

                                        </div>
                                    </div>
                                </div>
                                <div style="float:left; width: 400px;">
                                    <input style="border: 1px solid #dddddd; margin-left:95px; background:#f5f5f5; font-weight:bold; color:#78AB46;" type='button' value='Click to add step' id='addButton'>
                                    <input style="border: 1px solid #dddddd; background:#f5f5f5; font-weight:bold; color:#c16b54;" type='button' value='Click to remove last' id='removeButton'>
                                </div>

                        </div>
                    </div>





                    <div id="fragment-5" class="ui-tabs-panel">
                        <div class="dividerlarge">

                        <div style="margin-bottom:10px;" class="form">
                            <label for="allergy">Allergy:</label>
                                <div class="formholder">

                                    <label style="outline: 5px solid #f5f5f5;" class="radios">
                                    <input type="checkbox" name="gluten" value="1" /> <img class="radios" src="style/images/gluten.gif"> 
                                    Gluten Free
                                    </label>

                                    <label style="outline: 5px solid #f5f5f5;" class="radios">
                                    <input type="checkbox" name="fat" value="1" /> <img class="radios" src="style/images/fatfree.gif"> 
                                    Fat Free
                                    </label>

                                    <label style="outline: 5px solid #f5f5f5;" class="radios">
                                    <input type="checkbox" name="vegan" value="1" /> <img class="radios" src="style/images/vegan.gif"> 
                                    Vegan
                                    </label>

                                    <label style="outline: 5px solid #f5f5f5;" class="radios">
                                    <input type="checkbox" name="vegetarian" value="1" /> <img class="radios" src="style/images/vegetarian.gif"> 
                                    Vegetarian
                                    </label>

                                    <label style="outline: 5px solid #f5f5f5;" class="radios">
                                    <input type="checkbox" name="egg" value="1" /> <img class="radios" src="style/images/chilli.png"> 
                                    Egg
                                    </label>

                                    <label style="outline: 5px solid #f5f5f5;" class="radios">
                                    <input type="checkbox" name="shellfish" value="1" /> <img class="radios" src="style/images/chilli.png"> 
                                    Shellfish
                                    </label>

                                    <label style="outline: 5px solid #f5f5f5;" class="radios">
                                    <input type="checkbox" name="dairy" value="1" /> <img class="radios" src="style/images/chilli.png"> 
                                    Dairy
                                    </label>

                                    <label style="outline: 5px solid #f5f5f5;" class="radios">
                                    <input type="checkbox" name="nuts" value="1" /> <img class="radios" src="style/images/chilli.png"> 
                                    Nuts
                                    </label>

                                    <label style="outline: 5px solid #f5f5f5;" class="radios">
                                    <input type="checkbox" name="lowsodium" value="1" /> <img class="radios" src="style/images/chilli.png"> 
                                    Low Sodium
                                    </label>

                                </div>   
                            </div>

                        </div>
                    </div>





                    <div id="fragment-6" class="ui-tabs-panel">
                        <div class="dividerlarge">
                        <div style="height:350px;">
                        <div style="margin-bottom:10px;" class="form">
                        <label for="title">Difficulty</label>
                            <div class="formholder">

                                <label style="outline: 5px solid #f5f5f5;" class="radios">
                                <input type="radio" name="difficulty" value="1" /> 
                                    <img class="radios" src="style/images/color_star.png">
                                    <img class="radios" src="style/images/gray_star.png">
                                    <img class="radios" src="style/images/gray_star.png">
                                    <img class="radios" src="style/images/gray_star.png">
                                    <img class="radios" src="style/images/gray_star.png"> 
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Beginner
                                </label>

                                <label style="outline: 5px solid #f5f5f5;" class="radios">
                                <input type="radio" name="difficulty" value="2" /> 
                                    <img class="radios" src="style/images/color_star.png">
                                    <img class="radios" src="style/images/color_star.png">
                                    <img class="radios" src="style/images/gray_star.png">
                                    <img class="radios" src="style/images/gray_star.png">
                                    <img class="radios" src="style/images/gray_star.png"> 
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Intermediate
                                </label>

                                <label style="outline: 5px solid #f5f5f5;" class="radios">
                                <input type="radio" name="difficulty" value="3" /> 
                                    <img class="radios" src="style/images/color_star.png">
                                    <img class="radios" src="style/images/color_star.png">
                                    <img class="radios" src="style/images/color_star.png">
                                    <img class="radios" src="style/images/gray_star.png">
                                    <img class="radios" src="style/images/gray_star.png"> 
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Advanced
                                </label>

                                <label style="outline: 5px solid #f5f5f5;" class="radios">
                                <input type="radio" name="difficulty" value="4" /> 
                                    <img class="radios" src="style/images/color_star.png">
                                    <img class="radios" src="style/images/color_star.png">
                                    <img class="radios" src="style/images/color_star.png">
                                    <img class="radios" src="style/images/color_star.png">
                                    <img class="radios" src="style/images/gray_star.png"> 
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Expert
                                </label>

                                <label style="outline: 5px solid #f5f5f5;" class="radios">
                                <input type="radio" name="difficulty" value="5" /> 
                                    <img class="radios" src="style/images/color_star.png">
                                    <img class="radios" src="style/images/color_star.png">
                                    <img class="radios" src="style/images/color_star.png">
                                    <img class="radios" src="style/images/color_star.png">
                                    <img class="radios" src="style/images/color_star.png"> 
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Professional
                                </label>

                            </div>
                        <br/>
                        </div>

                        <div style="margin-bottom:10px;" class="form">
                        <label for="hot">Heat:</label>
                            <div class="formholder">

                                <label style="outline: 5px solid #f5f5f5;" class="radios">
                                    <input type="radio" name="hot" value="0" checked="yes"/> 
                                        <img class="radios" src="style/images/cold.png"> Not Spicy
                                </label>

                                <label style="outline: 5px solid #f5f5f5;" class="radios">
                                    <input type="radio" name="hot" value="1" /> 
                                        <img class="radios" src="style/images/chilli.png">
                                </label>

                                <label style="outline: 5px solid #f5f5f5;" class="radios">
                                    <input type="radio" name="hot" value="2" /> 
                                        <img class="radios" src="style/images/chilli.png">
                                        <img class="radios" src="style/images/chilli.png">
                                </label>

                                <label style="outline: 5px solid #f5f5f5;" class="radios">
                                    <input type="radio" name="hot" value="3" /> 
                                        <img class="radios" src="style/images/chilli.png">
                                        <img class="radios" src="style/images/chilli.png">
                                        <img class="radios" src="style/images/chilli.png">
                                </label>

                                <label style="outline: 5px solid #f5f5f5;" class="radios">
                                    <input type="radio" name="hot" value="4" /> 
                                        <img class="radios" src="style/images/chilli.png">
                                        <img class="radios" src="style/images/chilli.png">
                                        <img class="radios" src="style/images/chilli.png">
                                        <img class="radios" src="style/images/chilli.png">
                                </label>

                                <label style="outline: 5px solid #f5f5f5;" class="radios">
                                    <input type="radio" name="hot" value="5" /> 
                                        <img class="radios" src="style/images/chilli.png">
                                        <img class="radios" src="style/images/chilli.png">
                                        <img class="radios" src="style/images/chilli.png">
                                        <img class="radios" src="style/images/chilli.png">
                                        <img class="radios" src="style/images/chilli.png">
                                </label>
                            </div>   
                        </div> 

                        <div style="margin-bottom:10px;" class="form">
                            <label for="hot">Cuisine:</label>
                                <div class="formholder">
                                    <select style="outline: 5px solid #f5f5f5; border: 1px solid #A2B1C5; padding: 4px; margin-bottom: 4px;" name="cuisine" id="cuisine">
                                        <option value="African">African</option>
                                        <option value="British">British</option>
                                        <option value="Caribbean">Caribbean</option>
                                        <option value="Chinese">Chinese</option>
                                        <option value="Contemporary">Contemporary</option>
                                        <option value="French">French</option>
                                        <option value="Greek">Greek</option>
                                        <option value="Indian">Indian</option>
                                        <option value="Italian">Italian</option>
                                        <option value="Japanese">Japanese</option>
                                        <option value="Lebanese">Lebanese</option>
                                        <option value="Mediterranean">Mediterranean</option>
                                        <option value="Mexican">Mexican</option>
                                        <option value="Middle Eastern">Middle Eastern</option>
                                        <option value="Pacific">Pacific</option>
                                        <option value="North American">North American</option>
                                        <option value="Spanish">Spanish</option>
                                        <option value="Thai">Thai</option>
                                    </select>
                                </div>   
                        </div> 

                            <div class="form">
                                <input style="background: #f5f5f5 url(style/images/tick.png) no-repeat left; width:150px; margin-bottom:25px; margin-left:90px;" type="submit" id="send" value="Save Recipe">
                            </div>  
                        </form>

                        </div></div>



                        <?php
        }   
    }
    else echo "<script language=\"Javascript\" type=\"text/javascript\">document.location.href='index.php'</script>";
    ?>

</body>
</html>

Can you see any reason it is not sending the data?? 您能看到没有发送数据的任何原因吗?

I will be eternally greatful for any advice 我将永远感激任何建议

It usually helps when you call the post function. 通常在调用post函数时会有所帮助。

(sorry... I'm on my phone /) (抱歉...我在用手机/)

$.post("something.php", {variable: var}, function(reply)
{
 $('#something').html(reply);
});

This might not be the answer . 这可能不是答案。 .

But I'll give you a good suggestion that would make HTML & JS much cleaner and easier and things much cleaner 但是,我会给您一个很好的建议,这将使HTML和JS变得越来越干净,事情也变得更加干净。

Create 创造

<!--Add this in your html and set to display none to keep it hidden-->
<div id='toClone' style='display:none'>
   put the html code in here instead of putting it in JS and handling all the single & double quotes..
  and use this syntax   <input id="step{COUNTER}" name="step{COUNTER}" />.............etc
</div>

now in your JS 现在在您的JS中

do this : 做这个 :

var newHtml = $("#toClone).html();
while(newHtml.indexOf("{COUNTER}")>-1){
    newHtml = newHtml.replace("{COUNTER}",counter);
}

now append the newHTML 现在附加newHTML

this is just a cleaner way for cloning instead of writing a lot of html in JS . 这只是一种更干净的克隆方式,而不是在JS中编写很多html。

I would suggest you try something like Fiddler to see what's actually in the form data as it's posted back to the page. 我建议您尝试使用诸如Fiddler之类的方法来查看表单数据在回发到页面时的实际含义。

You have: 你有:

newTextBoxDiv.after().html('<div...

I don't think that's the correct syntax and it gives me a Javascript error in Chrome. 我认为这不是正确的语法,它给了我Chrome中的Javascript错误。 There is no 0-argument option for .after() . .after()没有0参数的选项。 Do you maybe mean newTextBoxDiv.html().after(... ? 您可能是指newTextBoxDiv.html().after(...吗?

BTW, I notice you have a hidden input and a textarea with the same name and id for step1. 顺便说一句,我注意到您有一个隐藏的输入和一个文本区域,具有与第一步相同的名称和ID。 That's not valid HTML. 那不是有效的HTML。 id attributes must be unique. id属性必须是唯一的。 I assume that's the same for the blocks you're generating dynamically. 我认为对于您动态生成的块来说是相同的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM