Hello there,
I want to introduce message system in my website. I've created table fields as follows:
id(int), receiver_id, msg_id, msg_sub, msg_desc, msg_time

Below is my html form in which registered users will be displayed in dropdown list:

<form class="form-horizontal" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
    <legend>Send Message</legend>
        Recipient:<select name="receiver_id" data-rel="chosen" onchange="showValues()">
            <?php
                $query = "SELECT * FROM star.users";
                $run = mysql_query($query);
                while( $row = mysql_fetch_assoc($run) ){
                    $receiver_id = $row['id'];
                    $usrname = $row['username'];
            ?>
            <option value="<?php echo $receiver_id; ?>" ><?php echo $usrname; ?></option>
            <?php } ?>
            </select> 
            Subject:<input type="text" name="msg_sub" value="" />
            Message:<textarea name="msg_desc" rows="4" value="" /></textarea>
             <button type="submit" name="send">Send</button>
             <button type="reset" >Cancel</button>
</form>

Now how to get receiver id from selected user and send sms to that user ?

Recommended Answers

You can use javascript function alert. For example
<body onload="alert('Your message')">

Jump to Post

Im not so sure myself but tried googling(did you try searching?) and found this site that "How to Send Text Messages with PHP" hopefully this can help you. according to the author, its pretty simple. good luck

Jump to Post

All 5 Replies

You can use javascript function alert. For example
<body onload="alert('Your message')">

Okay, But How to send message to the selected user and store in database ?

Hello nadiam thanx for your reply, But I want to send message to the registered users inbox on this website only. Not to mobile phone.

Like one facebook user send message to another user.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.