简体   繁体   中英

Input type hidden dosent hide in form when the value is larger in php

I am trying to setup hidden input field value to an xml string which is obtained from an array . But the hidden field value is displayed in html while when i put a normal text as value in the hidden field it works fine.

//a large sized associative array convert to xml and set as hidden field 
            $item_array=array();
            $xml=new SimpleXMLElement('<OriginDestinationOption/>');
            array_walk_recursive($item_array,array($xml,'addChild')); 
           echo '<input type="hidden" name="return-xml" value="'.$xml->asXML();.'" />'; ?>

But it displays the value in html form.Whats wrong with my code?

Note:I am using codeigniter framewrok

The data will be overflowing the input. Try to add css to input as "overflow:hidden"

尝试这个

 echo '<input type="hidden" style="display:none;" name="return-xml" value="'.str_replace('"',"'",$xml->asXML());.'" />'; ?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM