So, you want to build a form containing 10 000 mobile numbers, and submit it to an SMS service. The first questions you may ask yourself:
- Would the SMS service accept so many numbers?
- Isn't there a way to do the same task in steps, using only a subset of mobile numbers at each step?
- Does it really make sense to generate the form, display it to the person behind a browser, and let this person submit it, given all the constraints?
If you consider just the last question, the answer would probably be negative. Displaying such form:
Is a disaster from the point of view of the privacy of your customers (unless the mobile numbers are not the numbers your customers gave you, and you're just a spammer). Why would you ever send to anyone an HTML code containing every number of every person who trusted you, ignoring how do you care protecting sensitive data?
It simply doesn't make sense to flush all this data to the client and let the client flush it somewhere else. Why not sending it directly to the final destination? Don't waste everyone's' bandwidth without need.
Browsers will uselessly suffer from such large amount of data on some low-end machines. You're wasting your servers' processor power, you're wasting clients' processor power, and you increase the risk of something going wrong. Like the client who submits the form once, waiting for a while, and, thinking that it wasn't submitted, resubmits it.
The SMS service probably uses an API key. Does that mean that you're publicly showing the key as well? Why?
What about input validation? Since you don't do any, it means that anyone may send anything to all of your customers' mobile phones. What a lucky day for a hacker. And it becomes even better since you let everyone see the list of mobile phones and the API key.
What you can do instead is to show to the user a simple, basic form with the text area itself to type the message (or any other form from which the message will be generated). When submitted, you validate the input, and, if correct, make one or several HTTP requests to the SMS service yourself, from the server. If SMS service is able to handle lots of mobile numbers at once, you'll still have your
select MobileNumber from Customer. If not, MySQL
limit clause can be used to paginate data.
See, no disclosure of sensitive data, no security issues, no wasted network bandwidth, and reduced impact on the CPU.