A Digital Age Deserves A Digital Leader

sms/text messanger ** help please **

sms/text messanger ** help please **

Postby c0ldfyr3 » Thu Sep 06, 2007 12:48 am

so i want to edit this code to allow for the user to select the service provider for the phone they want to text.

here is the code that i have so far. i need to change the "@messaging.sprintpcs.com " to look at a dropdown box using the currently selected provider as the domain to send the message to. and i am not sure how to make a dropdown box in php and link it. can anyone help out here.

Code: Select all
// Process the form if it was submitted
if (isset($_POST['do'])) {

    // Parse the data submitted from the form
    $number = trim($_POST['number']);
    $subject = trim($_POST['subject']);
    $message = trim($_POST['message']);

    // Check that the phone number is numeric
    if (!is_numeric($number)) {
        $error = "Please enter a phone number containing only digits 0-9.";

    // Make sure the phone number doesn't start with 911
    } elseif (eregi("^(911)(.*)$", $number)) {
        $error = "Please enter a valid phone number.";

    // Check that the phone number is 10 digits
    } elseif (strlen($number) != "10") {
        $error = "Please enter a phone number that is 10 digits (the 3 digit area code and 7 digit number).";

    // Check that the subject doesn't contain HTML characters
    } elseif (eregi("^(.*)(<|>)(.*)$", $subject)) {
        $error = "The subject of the message cannot contain HTML characters (such as &gt; or &lt;).";

    // Check that the message doesn't contain HTML characters
    } elseif (eregi("^(.*)(<|>)(.*)$", $message)) {
        $error = "The message cannot contain HTML characters (such as &gt; or &lt;).";

    // Check that the subject is between 3 and 20 characters
    } elseif ((strlen($subject) < "3") || (strlen($subject) > "20")) {
        $error = "The subject must be between 3 and 20 characters in length.";

    // Check that the message is between 3 and 120 characters
    } elseif ((strlen($message) < "3") || (strlen($message) > "120")) {
        $error = "The message must be between 3 and 120 characters in length.";

    // Send the message
    } else {

        // Where are we sending it?
        $to = "" . $number . "@messaging.sprintpcs.com ";

        // Send the text message
        if (@mail($to, $subject, $message)) {

            // Give a success notice
            echo "Text message sent.";
            echo "</center>\n";
            echo "</body>\n";
            echo "</html>\n";
            exit;

        // Give an error if message can't be sent
        } else {
            $error = "Sorry, there was an error while trying to send the message - please try again later.";
        }
    }
}

// Show any errors encountered
if (isset($error)) {
    echo "<font color="red\"><b>" . $error . "</b></font><br><br>\n";
}
Image
PRO Level 15
User avatar
Posts: 1346
Joined: Sun May 02, 2004 8:49 pm
Location: 127.0.0.1

Postby NoReflex » Thu Oct 04, 2007 8:44 pm

Sorry for the delay but I have been "offline" for some time.
Would this work?
Code: Select all
 </option>


You could check this page too : http://www.felgall.com/htmlt20.htm

Best of luck!
PRO Level 10
User avatar
Posts: 431
Joined: Wed Nov 17, 2004 8:41 pm
Location: Romania

Postby NoReflex » Thu Oct 04, 2007 8:46 pm

Sorry for the delay but I have been "offline" for some time.
Would this work?
Code: Select all
// We make a select box form variable named 'menu'
// We want to have a dynamic item in that box selected
// Prepare the selection variable
unset($sel_menu);
unset($sel_menu2);
$sel_menu[$_POST['menu']] = "SELECTED";

// Print "SELECTED" in the proper option
// The other options will have blank values
echo "
   <select>
      <option>Default</option>
      <option>Option1</option>
      <option>Option2</option>
      <option>Option3</option>
      <option>Option4</option>
   </select>
   ";


You could check this page too : http://www.felgall.com/htmlt20.htm

Best of luck!
PRO Level 10
User avatar
Posts: 431
Joined: Wed Nov 17, 2004 8:41 pm
Location: Romania

Postby NoReflex » Thu Oct 04, 2007 8:47 pm

Sorry for the delay but I have been "offline" for some time.
You might check here for an idea : http://isnoop.net/dev/drop_down.php

You could check this page too : http://www.felgall.com/htmlt20.htm

Best of luck!
Last edited by NoReflex on Thu Oct 04, 2007 8:49 pm, edited 1 time in total.
PRO Level 10
User avatar
Posts: 431
Joined: Wed Nov 17, 2004 8:41 pm
Location: Romania

Return to HTML, CSS, and Scripts

Who is online

Users browsing this forum: No registered users and 1 guest