Code update:
PHP Code:
<?php
$con = mysql_connect("localhost","friendko_admin","Macbookpro17#");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("friendko_text", $con);
$query = "SELECT id, email, key FROM friendko_text WHERE key = '{$_POST['key']}'";
$result = mysql_query($query);
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
echo '11 Digit Key: ' . $row['key'] . '<br>';
echo 'Email: ' . $row['email'] . '<br>';
echo 'Carrier: ' . $carrier'] . '<br>';
}
$to = $_POST['to'];
$carrier = $_POST['carrier'];
$message = stripslashes($_POST['message]);
if ((empty($from)) || (empty($to)) || (empty($message))) {
header ("Location: sms_error.php");
}
else if ($carrier == "verizon") {
$formatted_number = $to."@vtext.com";
mail("$formatted_number", "SMS", "$message");
// Currently, the subject is set to "SMS". Feel free to change this.
header ("Location: sms_success.php");
}
else if ($carrier == "tmobile") {
$formatted_number = $to."@tomomail.net";
mail("$formatted_number", "SMS", "$message");
header ("Location: sms_success.php");
}
else if ($carrier == "sprint") {
$formatted_number = $to."@messaging.sprintpcs.com";
mail("$formatted_number", "SMS", "$message");
header ("Location: sms_success.php");
}
else if ($carrier == "att") {
$formatted_number = $to."@txt.att.net";
mail("$formatted_number", "SMS", "$message");
header ("Location: sms_success.php");
}
else if ($carrier == "virgin") {
$formatted_number = $to."@vmobl.com";
mail("$formatted_number", "SMS", "$message");
header ("Location: sms_success.php");
}
?>
HTML
PHP Code:
<html>
<head>
</head>
<body>
<form id="sms" name="sms" method="post" action="send.php">
<table width="400">
<tr>
<td align="right" valign="top">11 Digit ID:</td>
<td align="left"><input name="key" type="text" id="key" size="11" /></td>
</tr>
<td align="right" valign="top">Message:</td>
<td align="left"><textarea name="message" cols="40" rows="5" id="message"></textarea></td>
</tr>
<tr>
<td colspan="2" align="right"><input type="submit" name="Submit" value="Submit" /></td>
</tr>
</table>
</form>
</body>
</html>
I did make the key change to the html form, the php code is not redirecting. Thanks for all your help!
Quote:
Originally Posted by _Aerospace_Eng_
$_POST['key'] will always be empty. You have no form input with name="key". You probably got some kind of key from the place letting you use their SMS service that you need to provide to their api.
|