RE: [PHP-DB] display variable variables in a text field in a form
| From: | Steve Brett | Date: | Fri, 18 May 2001 10:33:57 +0000 |
| Subject: | RE: [PHP-DB] display variable variables in a text field in a form | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-9426@lists.php.net to get a copy of this message | ||
i always use:
print "<td>".$values."</td>";
sometimes i can get away without splitting the string but generally i find
it easier to do it this way ...
p.s. if there are any rules i'm not aware of as to the format of strings
including values from db's i'd be really grateful if someone could point
them out.
steve
> -----Original Message-----
> From: Shahmat Dahlan [mailto:shahmatd@sains.com.my]
> Sent: 18 May 2001 11:29
> To: PHP-DB
> Subject: [PHP-DB] display variable variables in a text field in a form
>
>
>
> $fields=array("fname","lname","dept","city","ophone","hphone",
> "fax","ema
> il");
>
> $sqlstmt="SELECT * FROM contacts WHERE id='$id'";
> $result=mysql_query($sqlstmt);
> foreach ($fields as $values) {
> print " <tr $rowcolor>\n <td>$fieldn</td>\n
> <td><input
> type=\"text\" name=\"$values\"
> value=\"$$values\"></td>\n </tr>\n";
> }
>
> I'm not sure how to explain this, when do the above (I have ommited
> certain portions of my codes). The form will be displayed as:
>
> First Name $fname
> Last Name $lname
> Department $dept
> City $city
> Office Phone $ophone
> Handphone $handphone
> Fax $fax
> E-mail $email
>
> How do I make it to display the actual values of $fname instead of the
> variable name itself?
>
> Thanks in advance..
>
> regards
>