I have the following Ajax script to process a form within my DIV:

<script type="text/javascript">
// we will add our javascript code here

$(document).ready(function(){
$("#ajax-contact-form").submit(function(){

var str = $(this).serialize();

$.ajax({
type: "POST",
url: "contact.php",
data: str,
success: function(msg){

$("#note").ajaxComplete(function(event, request, settings){

if(msg == 'OK') // Message Sent? Show the 'Thank You' message and hide the form
{
result = '<div class="notification_ok"><br><br><br><br><br><block quote>Thank You!<p>Your message has been sent and we will contact you at our earliest conveniece.<p>Thank you!</blockquote></div>';
$("#fields").hide();
}
else
{
result = msg;
}

$(this).html(result);

});

}

});

return false;

});

});

</script>

I have manipulated this script for another DIV, but it's not producing the same results as the first div - even after renaming the DIV ID.

I have a semi-working version of it here for you to see:
http://www.prescriptionpc.com/TEST_newpage1.html#section=contact (this one works PERFECT)

http://www.prescriptionpc.com/TEST_newpage1.html#section=sms (this is one I am having problems with)

The code I have for my "sms" DIV is as follows:

==================================================

<?php

error_reporting (E_ALL ^ E_NOTICE);

$post = (!empty($_POST)) ? true : false;

if($post)

$from = stripslashes($POST['from']);
$to = stripslashes($
POST['to']);
$carrier = stripslashes($POST['carrier']);
$message = stripslashes($
POST['message']);

if ($carrier == "verizon") {
$formatted_number = $to."@vtext.com";
mail("$formatted_number", "Msg from Website", "$message");
// Currently, the subject is set to "SMS". Feel free to change this.

echo '<div class="notification_error">'.$error.'</div>';
}

else if ($carrier == "tmobile") {
$formatted_number = $to."@tomomail.net";
mail("$formatted_number", "SMS", "$message");

echo '<div class="notification_error">'.$error.'</div>';
}

else if ($carrier == "sprint") {
$formatted_number = $to."@messaging.sprintpcs.com";
mail("$formatted_number", "SMS", "$message");

echo '<div class="notification_error">'.$error.'</div>';
}

else if ($carrier == "att") {
$formatted_number = $to."@txt.att.net";
mail("$formatted_number", "SMS", "$message");

echo '<div class="notification_error">'.$error.'</div>';
}

else if ($carrier == "virgin") {
$formatted_number = $to."@vmobl.com";
mail("$formatted_number", "SMS", "$message");

$error = '';

// Check name

if(!$from)
{
$error .= 'Please Enter Your Name.<br />';
}

// Check recipient

if(!$to)
{
$error .= 'Please Enter Recipient Phone Number<br />';
}

// Check message (length)

if(!$message)
{
$error .= "Please Type Your Message.<br />";
}

{
echo 'OK';
}

}
else
{
echo '<div class="notification_error">'.$error.'</div>';
}

?>

ANY help would be greatly appreciated!
Thanks!
-Bruce

    I just wanted to tell you to wrap your code in PHP tags, when I noticed this:

    if($post)
    
    $from = stripslashes($_POST['from']);
    $to = stripslashes($_POST['to']);
    $carrier = stripslashes($_POST['carrier']);
    $message = stripslashes($_POST['message']);

    I don't think that's what you wanted. This?

    if ($post) {
        $from = stripslashes($_POST['from']);
        $to = stripslashes($_POST['to']);
        $carrier = stripslashes($_POST['carrier']);
        $message = stripslashes($_POST['message']);
    }

    Also, why don't you try using an assoc array:

    $tel = array('verizon' => '@vtext.com', 'tmobile' => '@tomomail.net');
    
    $carrier = 'verizon';
    
    foreach ($tel as $k => $v) {
        if ($carrier == $k) {
            $formatted_number = $to . $v;
            mail($formatted_number, "SMS", $message);
        }
    }

      I used the tag enclosure, but I still get the same results..

      As far as (this) goes - if I am able to change that, it could make a difference.
      What would I need to change on that to differentiate it from the other one?

      Thanks in advance!

        I used the tag enclosure, but I still get the same results..

        Mister, I was referring to the PHP tags when posting in forums, not the ones in your code. As in [.PHP] [./PHP] w\o the dots. Edit your first post and wrap your code. You have 3 of them: HTML, CODE and PHP. Use accordingly.

          Write a Reply...