-2

I am using codeigniter for my project and I want to know how codeigniter can use for echo to shows a message that send to a mobile phone. it shows the php code instead of the message.

https://i.stack.imgur.com/HF0xf.png

$this->sms->message('Thank you for your order Your order has been received and will be processed shortly<br>Your order ID: <?php echo $order_id ?>');
  • How is it sent? Show your code. Apparently, the PHP is not executed, it is just treated as a String. As said below, it doesn't seem to have anything to do with Android and JavaScript. – blex Aug 23 '15 at 15:58
  • It appears to be sent as SMS, not related to Android if so. – DeDee Aug 23 '15 at 15:58
  • by the looks of that image, your file isn't `.php` - It's showing PHP code and not being properly parsed. This has nothing to do with smart phones. This is serverside processing, not client-side. Show your codes. – Funk Forty Niner Aug 23 '15 at 15:59
  • I Posted my code under the post – Suleka Jayawardena Aug 23 '15 at 16:02

2 Answers2

2

You're already in PHP, therefore you need to remove the <?php and ?> tags.

Plus, variables do not get parsed in single quotes, therefore you need to use double quotes.

$this->sms->message("Thank you for ... shortly<br>Your order ID: $order_id");

I also hope that your files are a .php extension.

For more information on single/double quotes, read the following Q&A on Stack:

Community
  • 1
  • 1
Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141
  • Thanks for the edit blex. I need to add something but I will keep yours. – Funk Forty Niner Aug 23 '15 at 16:07
  • 1
    Sure, I just thought it would be nice not to have to scroll to see the changes you made ;) +1 – blex Aug 23 '15 at 16:08
  • 1
    @blex Je me demande s'il y a une section francophone sur Stack. Je n'ai jamais regarder/chercher. Sinon, ce serait bien d'en avoir une. *arrivederci!* – Funk Forty Niner Aug 23 '15 at 16:47
  • I don't believe there is one in French, but there is one in [Russian](http://ru.stackoverflow.com/). Peut-être plus tard, but it does not bother me, I think having a common site in English for every country is the best way to gather the most answers and questions. Furthermore, it's a good way to practice our English :) PS: J'adore la Poutine ! - Non, je ne réduis pas le Canada à la Poutine ;) – blex Aug 23 '15 at 16:59
  • 1
    @blex Indeed. The English language is the most widely used, and more so in business. Ouais, notre poutine est la meilleure. Le secret est dans la sauce ;-) prend soin. – Funk Forty Niner Aug 23 '15 at 17:05
0

I Generally Use this code. Change the settings. I got this link through 'mysmsmantra'

$OrderMessage=urlencode("Dear Customer, Order $OrderId of Rs. $TotalPayableAmount is accepted by Sangakara. Thank You");
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, 
    "http://bulksms.mysmsmantra.com:8080/WebSMS/SMSAPI.jsp?username=sangakara&password=password&sendername=sendername&mobileno=$MobileNo&message=$OrderMessage"
);
$content = curl_exec($ch);
Nana Partykar
  • 10,556
  • 10
  • 48
  • 77