weixin_33726318 2014-04-10 15:52 采纳率: 0%
浏览 25

jQuery,Ajax请求,PHP

Wondering how I can get if the value of a checkbox if it's checked then I want it be stored in a PHP session if possible.

Not sure this can be done. Hence the question on here!

Here's a small/important part of the code I have.

      <div class="accessories-right">
         <h3><?php echo $row['title'] ;?></h3>
         <p><?php echo $row['description']; ?></p>
         <div style="width: 700px; float: left; min-height: 20px;">
             <div id="ck-button">
                 <label>
                     <input type="checkbox" value="1" style="visibility: hidden;" name="checked" class="box" id="box"><span>SELECT</span>
                 </label>
             </div>
             <div class="accessories-text"><?php echo $row['price']; ?></div>
         </div>
     </div>
        <div style="margin: 20px 0px 40px 0px; padding:0; clear: both;"></div>


    <div style="float: left; margin: 3px 0px 0px 760px;">
        <button class="green-btn" id="more">Continue &raquo;</button>
    </div>

The button has an ID and I have tried something like stated below: But I need it to be on the same page and store in a session to use later.

 $(".success").hide();
        $(".error").hide();

        $("#more").click(function() {
            var checked = $("#box").val();
            var dataString = 'checked='+ checked;

            if(checked == '')
            {
               $(".success").hide();
               $(".error").show();
            }
            else
            {
                $.ajax({
                    type: "POST",
                    url: "accessories_post.php",
                    data: checked,
                    success: function() {
                        $(".success").show();
                        $(".error").hide();
                    }
                });
            }
            return false;
        });

But this isn't really doing what I want it to do.


Sorry I also forgot to add that I'm wanting to like select multiple items then add them to a mail() function to email this info off to the client.

enter image description here

So i'd like to select either or of these items then have it sent to the client via email

  • 写回答

2条回答

      报告相同问题?

      相关推荐 更多相似问题

      悬赏问题

      • ¥30 如何降低hdfs中datanode的JVM内存用量
      • ¥20 SQL数据查询,子查询
      • ¥15 c++字符串分割问题
      • ¥15 vue+uniapp
      • ¥15 android freedom
      • ¥15 使用自定义的类型代替内置类型可行吗
      • ¥15 关于STM32的SPI和ENDAT接口编码器通信的问题
      • ¥15 关于#pdfbox#生成的PDF文件正常,转图片中文乱码的问题,如何解决?
      • ¥15 ADS中有关DAC控件的使用问题
      • ¥15 win11如何运行geoserver