Manual Posted December 10, 2012 Report Share Posted December 10, 2012 Man vajag ievadīt vienā inpūt laukā vairākus simbolus kurus vajag atdalit ar komatu. Piemeram : uz datubāzi <input value="s1, s2, s3, s4"> (apmēram tapat ka seit "topic tags" ) Pēc aizsūtīšanas uz datubāzi kad es gribu viņu vilkt ara man vajag lai viņš man parādās select veidā.Piemeram: no datubāzes <select "> <option>s1</option> <option>s2</option> <option>s3</option> <option>s4</option> </select> Varētu lūdzu pateikt kā to izdarīt? Quote Link to comment Share on other sites More sharing options...
briedis Posted December 10, 2012 Report Share Posted December 10, 2012 Paskaties explode() funkciju, kā arī iešanu cauri masīviem ar foreach. Quote Link to comment Share on other sites More sharing options...
Manual Posted December 10, 2012 Author Report Share Posted December 10, 2012 vari lūdzu parādīt piemēru mazu? Quote Link to comment Share on other sites More sharing options...
rATRIJS Posted December 10, 2012 Report Share Posted December 10, 2012 <?phpforeach(explode(",", "learn,to,use,google") as $item) echo $item . "<br />"; Quote Link to comment Share on other sites More sharing options...
aaxc Posted December 10, 2012 Report Share Posted December 10, 2012 $string = 's1, s2, s3, s4'; $array = explode( ',' , $string ); $output = "<select>"; foreach( $array as $value ) { $output .= "<option>{$value}</option>"; } $output .= "</select>"; echo $output; Quote Link to comment Share on other sites More sharing options...
rATRIJS Posted December 10, 2012 Report Share Posted December 10, 2012 http://uk1.php.net/manual/en/language.types.array.php http://uk1.php.net/explode http://uk3.php.net/manual/en/control-structures.foreach.php Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.