dpik71879 2015-05-23 10:02
浏览 26

如何通过jQuery向PHP发送多个复选框数据

<form id="foo">
<input type="text" name="voucher" placeholder="voucher ID" class="bill_fillter"/>
<input type="text" name="voucher" placeholder="voucher ID" class="bill_fillter"/>
<input type="text" name="voucher" placeholder="voucher ID" class="bill_fillter"/>
</form>

This is my Jquery Code

 <script>

$("#foo").submit(function(event) {

/* Stop form from submitting normally */
event.preventDefault();

/* Clear result div*/
$("#result").html('');

/* Get some values from elements on the page: */
var values = $(this).serialize();

/* Send the data using post and put the results in a div */
$.ajax({
    url: "ajax_receipt_sms.php",
    type: "post",
    data: values,
    success: function(){
        alert("success");
        $("#result").html('Submitted successfully');
    },
    error:function(){
        alert("failure");
        $("#result").html('There is error while submit');
    }
});
});
</script>

ajax_receipt_sms.php

<?php
    $viuchid = $_POST['voucher'];
$sql1="SELECT * from usertable;
$result1 = mysql_query ($sql1);
 $row1 = mysql_fetch_array($result1)

      $CHEQUE_NO = $row1['CHEQUE_NO'];
        $cheqdate = $row1['CHEQUE_DATE'];
        $mobile = $row1['mobile'];
        $bank_name  = $row1['name'];
        $amt = $row1['Amount'];

        // split "dd-mm-yyyy" into an array of three elements
        $ddate = explode("-", $cheqdate);
        // retrieve the values
        $month = $ddate[1]; // mm
        $day = $ddate[2]; // dd
        $year = $ddate[0]; // yyyy
    ?>

<?php

$notify="Your message is successfully sent to:"."91".$mobile;
$message = "Dear Member, received with thanks Rs.".$amt. " by chq/cash dated " .$day.'-'.$month.'-'.$year. " drawn on " .$bank_name. "bank, from ".$_SESSION['socityname'].".";
$username = "xxx";
$password = "xxxxxx";
$sendername = "shoaib";
$url = "http://bulksms.mysmsmantra.com/WebSMS/SMSAPI.jsp?username=".$username."&password=".$password."&sendername=".$sendername."&mobileno=91".$mobile."&message=".urlencode($message);
// for sms send request
$ch=curl_init();
if($url)
curl_setopt($ch,CURLOPT_URL,$url);
$result = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);  
curl_close($ch);
?>

how to send multiple checkbox data to PHP via jQuery and send sms to multiple user, when i add multiple number to input box , it should send Sms to all data to the number.

  • 写回答

1条回答 默认 最新

  • dpvomqeu396484 2015-05-23 10:15
    关注

    I also think need to use array like voucher[] in input element of type check box.

    评论

报告相同问题?

悬赏问题

  • ¥15 ogg dd trandata 报错
  • ¥15 高缺失率数据如何选择填充方式
  • ¥50 potsgresql15备份问题
  • ¥15 Mac系统vs code使用phpstudy如何配置debug来调试php
  • ¥15 目前主流的音乐软件,像网易云音乐,QQ音乐他们的前端和后台部分是用的什么技术实现的?求解!
  • ¥60 pb数据库修改与连接
  • ¥15 spss统计中二分类变量和有序变量的相关性分析可以用kendall相关分析吗?
  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错