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.


> -----Original Message-----
> From: Shahmat Dahlan [mailto:[EMAIL PROTECTED]]
> 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

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to