i need help in php sending form to send multiple rows -
i have api of sms
<?php // configuration variables $type = "xml"; $id = "92300xxxxxxx"; $pass = "xxxxxxxxxxxx"; $lang = "english"; $mask = "outreach"; // data text message $to = "$_post['to']"; $message = "$_post['message']"; // prepare data post request $data = "id=".$id."&pass=".$pass."&msg=".$message."&to=".$to."&lang=".$lang."&mask=".$mask."&type=".$type; // send post request curl $ch = curl_init('http://www.outreach.pk/api/sendsms.php/sendsms/url'); curl_setopt($ch, curlopt_post, true); curl_setopt($ch, curlopt_postfields, $data); curl_setopt($ch, curlopt_returntransfer, true); $result = curl_exec($ch); //this result outreach curl_close($ch); ?>
now make form
<form method="post"> <input type="text" name="message"> <input type="text" name="to"> --->contact number list </form>
now want send sms multiple numbers can send 1 number @ 1 time can me in matter
you can add more input (or loop it) , set name array.
<input type="text" name="to[]" /> <input type="text" name="to[]" /> <input type="text" name="to[]" />
access looping through array
foreach( $_post['to'] $key => $val ) { echo 'send ' . $val .'<br />'; } //code not tested
Comments
Post a Comment