Jump to content

Passing data from php variables to a html form?


timi2shoes

Recommended Posts

first, we need to know how you stored the data, but if i assume you store it as a text file, then it would be like this:
[code]
<?php
$data = @file("data.txt"); // collect all data into an array
foreach($data as $v){list($fish,$cats) = explode("#",$v); // split up the differnt parts of the data with # sign
?>
[/code]
The above is getting the data from the text files, if you want to use this style of coding, please separate your different parts of data with # symbol.
and then you have already set the data into strings!
Now lets put them into the form:
[code]
<form name="test" action="" method="post">
<table>
<tr><td>fish:</font></td>
<td><input name="fish" type="text" id="fish" rows="11" cols="57" style="font-family: Arial" value="<? echo "$fish" ?>"></td>
<tr><td valign=top><font face="Arial">cats:</td></font>
<td><textarea name="cats" id="cats" rows="6" cols="57" style="font-family: Arial"><? echo "$cats" ?></textarea></td></tr>
[/code]
this is the form
there are two types ive shown here, one is text area, the other is input box, so far i am still having trouble myself with the combo boxes.
hope it helped
TED. :D

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.