rayidi 3 Light Poster

Dear Friends,
Am trying to builing a social networking site that user can post his update on profile text bat. Once we click on the share button the text field value will pass to the function of xmlHTTP request, but here is not passing a value. Please help me. I am posting my code here

    <script type="text/javascript">
    function update()
    {
    var str = document.getElementById("message").value;
    if (str.length==0)
      {
      document.getElementById("msgupdate").innerHTML="";
      return;
      }
    if (window.XMLHttpRequest)
      {// code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp=new XMLHttpRequest();
      }
    else
      {// code for IE6, IE5
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    xmlhttp.onreadystatechange=function()
      {
      while(xmlhttp.readyState<4)
      {
        document.getElementById("msgupdate").innerHTML="Wait for a moment";
      }
      if (xmlhttp.readyState==4 && xmlhttp.status==200)
        {
        document.getElementById("msgupdate").innerHTML=xmlhttp.responseText;
        }
      }
    xmlhttp.open("GET","showupdate.php?msg="+str,true);
    xmlhttp.send();
    }
    </script>

                            echo "<form action='' method='get'>";
                            echo "<div id='postmsg'>";
                                echo "<input type='text' id='message' name='postmsg' class='msgbox'>";
                            echo "</div>";
                            echo "<div id='uploadsection'>";
                                echo "<div class='btn'>";
                                    echo "<a href='' name='Upload Photos'><img src='images/add_pic_btn.gif' alt='Upload photos'></a>";
                                echo "</div>";
                                echo "<div class='btn'>";
                                    echo "<a href='' name='Upload Videos'><img src='images/add_video_btn.gif' alt='Upload videos'></a>";
                                echo "</div>";
                                echo "<div class='submit'>";
                                    echo "<a href='' onSubmit='update(this.form.postmsg.value)' name='Share'><img src='images/share_btn.gif' alt='Share to friends'></a>";
                                echo "</div>";
                            echo "</div>";
                        echo "</div>";
                        echo "</form>";

PHP Code: showupdate.php

<?php
    $msg = $_GET['msg'];

    if(strlen($msg) == 0 || $msg == "" || strlen($msg) == "0")
    {
        echo "<div id='msgerror'><i>Write something..</i></div>";
    }
    else
    {
        echo "<div id='msg'>";
        echo "Updated";
        echo "</div>";
    }
?>
Be a part of the DaniWeb community

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