• 0

[PHPt] Create form from text


Question

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

5 answers to this question

Recommended Posts

  • 0

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

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.