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

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.

ah right. sorry. what about this one? looks like the chat box daniweb uses. though i am not sure about the selected user part. maybe can play around with it if it helps.

http://www.dreamincode.net/forums/topic/44808-simple-text-chat-box/

and i think i read somewhere that there is a javascript widget for real time chat.

Be a part of the DaniWeb community

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