Jump to content

Recommended Posts

Ok here is what I have and what I need to do.  I have a simple form that works fine.  Here is the code:

 

<?php 
if ($_POST["email"]<>'') { 
$ToEmail = '5555555555@messaging.sprintpcs.com'; 
$EmailSubject = $_POST["subject"]."\r\n";
$mailheader = "From: ".$_POST["email"]."\r\n"; 
$MESSAGE_BODY = nl2br($_POST["message"]);
mail($ToEmail,$EmailSubject, $MESSAGE_BODY,$mailheader) or die ("Failure"); 
?> 
<font color="red"><b>Your Text has been sent. The message sent was:</b></font><br /><br />
<font face="tahoma" size="4"><?php echo $_POST["message"]; ?></font>

<br /><br />
- <b><a href="text.php">GO BACK</a></b>
<?php 
} else { 
?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="en-us" http-equiv="Content-Language" />
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Text Tool</title>
<style type="text/css">
.style1 {
text-align: center;
}
</style>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else 
countfield.value = maxlimit - field.value.length;
}
// End -->
</script>
</head>

<body>
<form action="text.php" method="post">
<table width="100%" border="0" cellspacing="2" cellpadding="0">
<tr>
	<td valign="top">
	Send To:<br />
		<select name="recip">

HERE IS WHERE THE OPTIONS WOULD BE DEPENDING ON HOW I NEED TO GET THEM HERE.  
Either hard coded or by query


		</select>
	</td>
</tr>


<tr>
<td>Message:<br /><textarea name=message wrap=physical onKeyDown="textCounter(this.form.message,this.form.remLen,143);" onKeyUp="textCounter(this.form.message,this.form.remLen,143);" cols="20" rows="6" id="comment" maxlength="143"></textarea><br /><input readonly type=text name=remLen size=3 maxlength=3 value="143" /> characters left
</td>
</tr>
<tr>
<td>
<input name="email" type="hidden" id="email" size="20" value="r@site.com"></td>
</tr>
<tr>

<td valign="top"><font color="red" size="2"><b>Do not hit enter for a new line. This will give you less characters to use due to the text limits.</b></font><br /><input type="submit" name="Submit" value="Send"></td>
</tr>

</table>
</form> 
</body>
</html>
<?php 
}; 
?>

 

What it does is emails the message to a cell phone number @messaging.sprintpcs.com. (You can see the mail to address at the very top). This all works great and is good to go.  I need to have the drop down at the top pull a query depending on the choice and get the phone numbers to email to.

 

Example:  You choose All Sups from the dropdown.  On send it queries the database and search's table "sprint" for "sup" in the "dept" row.  Once it finds the sups it then outputs the phone number from row "num" to the top of the form under $ToEmail.

 

So if I searched for all SUPS it would email about 9 people.  Anyone with the label "sup" in the dept row.

 

Any help is appreciated guys. 

$q = "select * from table_where_emails_are_stored...";
$ret = mysql_query($q);

print '<select name="email">';
while ($row = mysql_fetch_assoc($ret)) {
    $email_addr = $row['email'];
    print "<option value=\"$email_addr\">$email_addr</option>";
}

 

or something

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.