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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.