How to take HTML form data and write to XML using JQuery?

后端 未结 3 433
不思量自难忘°
不思量自难忘° 2021-01-16 18:38

I have a form that looks like this:

3条回答
  •  生来不讨喜
    2021-01-16 18:53

    You have to send Labels within hidden inputs, etc:

    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    

    and then in PHP you access pairs:

    $name = "a";  // "s", "g", "d"
    
    $tag = $_POST[$name.'_label'];
    $value = $_POST[$name];
    $xml_element = "<$tag>$value";
    

    OR

    use same name as label and then use:

    foreach($_POST as $key => $value)    
    {
        $xml_element = "<$key>$value";
        ...
    }
    

提交回复
热议问题