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

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -