Vernon de Goede Posted May 29, 2010 Share Posted May 29, 2010 Hi there, I want to be able to do the following: 1. I have a list with text, for example: one = een two = twee three = drie 2. From this list, I want PHP to create the following: <input type="text" value="one" id="langA"> <input type="text" value="een" id="langB"> <input type="text" value="two" id="langA"> <input type="text" value="twee" id="langB"> <input type="text" value="three" id="langA"> <input type="text" value="drie" id="langB"> Anyone knows how to do this? :-) Thanks in advance :-) Link to comment Share on other sites More sharing options...
0 n_K Posted May 29, 2010 Share Posted May 29, 2010 I find it much better to give the basics so that people research and learn. Basically, explode is what you want; $Lines = explode("\r\n". $DataInVariable); //Change \r\n if you're not using windows encoding. $i = 0; $l = count($Lines); while ($i < $l) { $Text = explode(" - ", $Lines[$i]); echo '<input type="text" value="'.$Text[0].'" id="langA"> <input type="text" value="'.$Text[1].'" id="langB">'; $i++; } Should work. Link to comment Share on other sites More sharing options...
0 sweetsam Posted May 29, 2010 Share Posted May 29, 2010 Except you can not repeat id's because they have to be unique. Class would be the one to use here. Link to comment Share on other sites More sharing options...
0 Kudos Veteran Posted May 29, 2010 Veteran Share Posted May 29, 2010 Allow me to blow your minds. Link to comment Share on other sites More sharing options...
0 nvme Posted May 29, 2010 Share Posted May 29, 2010 Allow me to blow your minds. lol Link to comment Share on other sites More sharing options...
0 Ahmed Samir Posted May 31, 2010 Share Posted May 31, 2010 Allow me to blow your minds. AMEN! Link to comment Share on other sites More sharing options...
Question
Vernon de Goede
Hi there,
I want to be able to do the following:
1. I have a list with text, for example:
2. From this list, I want PHP to create the following:
Anyone knows how to do this? :-)
Thanks in advance :-)
Link to comment
Share on other sites
5 answers to this question
Recommended Posts