sms manual input phone number

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: sms manual input phone number

Post by Celauran »

Part of your form processing expects $_POST['customer_phone'] to be a string, part expects it to be an array. I seem to recall you had users pulled from the database and dropped in a select list. Is that functionality still in place, or has it been replaced by the above? The reason I ask is that they both appear to be using the same form field name, which means they will use the same key in the $_POST array, which will lead to all manner of problems. Might be best to post the form (or the page containing it) in its entirety. Ditto for the script that processes the form.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: sms manual input phone number

Post by Celauran »

ianhaney wrote:You mention the select dropdown and the input field is using the same field name so would I just need to change the input field name within the form and then add it in to the php script that processes the form?
Mostly, yeah. If your checkboxes are customer_phone, your text field could be input_phone or some such, and your form processing would just need to check for both.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: sms manual input phone number

Post by Celauran »

You're sending too many arguments to sendSMS. Look at the function signature. Those are the values you need to send and the order in which you need to be sending them. Loop through customer_phone, then send manual_phone.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: sms manual input phone number

Post by Celauran »

Code: Select all

foreach ($_POST['customer_phone'] as $customer_phone) {
    $response = sendSMS('', '', $customer_phone, $smsmessage, $from);
}
if (isset($manual_phone)) {
    sendSMS('username', 'password', $manual_phone, $smsmessage, $from);
}
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: sms manual input phone number

Post by Celauran »

ianhaney wrote:Ahh got it makes sense when see the coding

so looping is foreach, I thought looping was while code

I got another major issue in regards to the checkboxes and the sms and show hide using jquery

each time I click any of the show or hide links it keeps checking the very first checkbox so it sends the sms to that person even though I don't mean to, shall I start a new post here or would it go in a javascript forum on here?

Is really frustrating me
Yeah, separate thread for a separate issue.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: sms manual input phone number

Post by Celauran »

ianhaney wrote:Just altered the coding as well you provided and said the sms has been sent but I have not received it, sorry
If you're getting a response from whichever provider you're using to send the SMS and they're saying it has been sent, that's not really something I can help with.
Post Reply