I created a form page that accepts some input and posts some variables to a php page. It is a text messaging api that runs via Twilio which is a MMS service I signed up for. They supplied me with the parameters and the php page which gets called in my post page. My form is..
Code: Select all
<form action="sendit.php" method="post" name="form1">
<table>
<tr>
<td align="right">Phone:</td>
<td><input type="text" name="phone" value=""></td>
</tr>
<tr>
<td align="right">Your Message:</td>
<td><input type="text" name="mymessage" value=""></td>
</tr>
<tr>
<td align="right"><input type="submit" value="Submit" name="submit"></td>
</tr>
</table>
</form>Code: Select all
<?php
// this line loads the library
require('Services/Twilio.php');
$account_sid = 'xxxxx';
$auth_token = 'xxxxx';
$client = new Services_Twilio($account_sid, $auth_token);
$myto["phone"] = $_POST["phone"];
$mybody["mymessage"] = $_POST["mymessage"];
;
$client->account->messages->create(array(
'To' => $myto,
'From' => "+19145551212",
'Body' => $mybody,
));
echo 'Sent ' .$_POST["mymessage"]. ' to '.$_POST["phone"];Code: Select all
echo 'Sent ' .$mybody. ' to '.$myto;So my first question is - Why cant I use my variables in an echo?
My 2nd question which will just make my life easier is: How can I send the phone number I would like to send the text message to the form (<input type="text" name="phone" value="">) from a link in an email so that it automatically gets filled in?
Thanks!