0

Can anyone help, please?
(The excellent solution on here for using an external SMS service does not "fit" )

My objective is to send an SMS "receipt" from an Agent's mobile (viewing our web page) instantly to the "payer" to acknowledge receipt of a (small) cash payment .... using the bundled SMS package wih the Agent's phone contarct ... not an external SMS service.

I'm hoping to do this from our website (which the Agent will be viewing at the time of transaction) rather than a dedicated App, if possible.

I have searched everywhere for a simple solution to this and successfully used the following as a prelimanry test

<p><a href="sms:77777777777?body=SMARTiPAY. £5 received, thank you. ">Send SMS welcome message to new member ></a></p>

.. but what I actually need now is a means of replacing both the "number" and "content" with variables generated from a form on the page .... input fields "mobilenum" and "message" (or other variables if spec needs to be different?)

This is the first time I have used a forum, so I hope I'm not abusing any etiquette or people's kindness.

Thank you

3
Contributors
8
Replies
16
Views
4 Years
Discussion Span
Last Post by kc.smith.100
0

@kc.smith.100

This is the first time I have used a forum, so I hope I'm not abusing any etiquette or people's kindness.

.. but what I actually need now is a means of replacing both the "number" and "content" with variables generated from a form on the page .... input fields "mobilenum" and "message" (or other variables if spec needs to be different?)

This question is more suited in the Mobile Development section rather than PHP section! If you hava a PHP code than it's fine but if you don't my advice is to post it in the Mobile Development section

Regarding about your issue you need a API and a simple form. I think it's best that you post it in the Mobile Development section so someone can help you there instead of here.

0

Hi,

So you have the message sending part sorted out, you just need to change the number and the message?

<?php
if (isset($_POST['mobilenum']) && isset($_POST['message'])){
    echo "<p><a href='sms:" . $_POST['mobilenum'] . "?body=" . $_POST['message'] . "'>Send SMS welcome message to new member</a></p>";
}
?>

This will check to see if the 2 form fields exist in the POST array (assuming your form is using the POST method). If both are set it will display the customised link. Don't forget to sanitize the POST variables before you use them.

0

Hi Zagga, thanks so much for coming to my rescue so quickly!

I tried adding your code to a previous attempt .... but something else must be wrong in my form construction ... would you mind taking a look please?

    <!DOCTYPE html>  
     <head>  
       <meta charset="utf-8" />  
      </head>  
      <body>  
       <div id="container">  
        <h1>Sending SMS with PHP</h1>  
        <form action="" method="post">  
         <ul>  
          <li>  
           <label for="mobilenum">Mobile Number</label>  
           <input type="text" name="mobilenum" id="mobilenum" /></li>  
          <li>  
           <label for="message">Message</label>  
           <textarea name="message" id="message" cols="45" rows="15"></textarea>  
          </li>  
         <li><input type="submit" name="sendMessage" id="sendMessage" value="Send Message" /></li>  
       </form> 

then your code .. sorry, I'm getting error message when trying to post)

On my Android (4.1) link DOES open SMS screen but with empty recipient and message fields. I hope, oeverall, this is not some restriction of Android OS that I'm troubling you with.

Is there some way under the rules to thank you properly for your help?

0

Hi again,

The following code works on my phone (ICS I think). It's your code and mine combined a little better. Can I just check that you are saving the file as a PHP file, not a HTML file?

<?php
if (isset($_POST['mobilenum']) && isset($_POST['message'])){
    echo "<p><a href='sms:" . $_POST['mobilenum'] . "?body=" . $_POST['message'] . "'>Send SMS welcome message to new member</a></p>";
} else {
?>
<!DOCTYPE html>
<head>
<meta charset="utf-8" />
</head>
<body>
<div id="container">
<h1>Sending SMS with PHP</h1>
<form action="" method="post">
<ul>
<li>
<label for="mobilenum">Mobile Number</label>
<input type="text" name="mobilenum" id="mobilenum" /></li>
<li>
<label for="message">Message</label>
<textarea name="message" id="message" cols="45" rows="15"></textarea>
</li>
<li><input type="submit" name="sendMessage" id="sendMessage" value="Send Message" /></li>
</form>
<?php } ?>
0

Zagga, thank you!!
You are an absolute b++++y marvel!
Not having any coding skills, but needing to get as close as possible to a working demo, I have trawled the web with every conceivable combination of words to find a solution, wasted hours reading pages & code .... tried scores of code bits ... and you've cracked it in no time!

Thanks so much! It seems to be against the rules, but is there some way I can at least send you a small reward? (My welcome from daniweb today says I can't post contact details?)

Marvellous!

0

ps .... Zagga .... are you good at PHP/MySQL too? (Just have a little thing to sort out with that .... but I really would like to pay something if there's a permitted way)

2

Hi again,

No reward is needed. As sickening as it sounds, helping people out is actually quite rewarding in itself :)

Votes + Comments
haha, me too!
Well said. I'll reward you for your hard work! =)
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.