www.webdeveloper.com
Results 1 to 3 of 3

Thread: sending xml object to php

Hybrid View

  1. #1
    Join Date
    Jan 2009
    Posts
    4

    sending xml object to php

    Hi,
    I need to send username received from html to php as xml object. There is some problem in my code.

    function adduser()

    {



    uname = document.getElementById("uname").value;

    alert(uname);

    xmlHttp=GetXmlHttpObject()

    if (xmlHttp==null)

    {

    alert ("Browser does not support HTTP Request")

    return

    }


    var url="sendxml.php"


    param = "<profile>" +"<username>"+escape(uname)+"</username>"+"</profile>"


    xmlstring=xmlToString(param);
    alert("entered");

    alert(xmlstring);

    xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded")



    xmlHttp.onreadystatechange=stateChanged

    xmlHttp.open("POST",url,true)

    xmlHttp.send("param="+xmlstring)





    }

    function xmlToString(xmlObj) {
    if (navigator.appName == "Netscape")
    {
    return (new XMLSerializer()).serializeToString(xmlObj);
    }
    if (navigator.appName == "Microsoft Internet Explorer")
    {
    return xmlObj.xml;
    }
    }

    Can anybody help me?

  2. #2
    Join Date
    Jun 2003
    Location
    here
    Posts
    4,551
    That's javascript, not PHP, post the problem there.

    AND USE [code] TAGS AROUND YOU CODE!

    If you don't it becomes hard to read like your post, I passed by your thread three times(I spotted the code outside of the code tags, figured it would be too much work for me to copy/paste it and restore some reasonable levels of indent before i could understand the code, and closed the tab without reading the post) before I decided to post this(which I am doing only because I have nothing else to do for the next 30 mins or so).

  3. #3
    Join Date
    Jan 2009
    Posts
    4

    Thank You

    I am a new guy. Thank You for your help.

    Quote Originally Posted by scragar View Post
    That's javascript, not PHP, post the problem there.

    AND USE [code] TAGS AROUND YOU CODE!

    If you don't it becomes hard to read like your post, I passed by your thread three times(I spotted the code outside of the code tags, figured it would be too much work for me to copy/paste it and restore some reasonable levels of indent before i could understand the code, and closed the tab without reading the post) before I decided to post this(which I am doing only because I have nothing else to do for the next 30 mins or so).

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles