Re: display variable variables in a text field in a form

From: Date: Fri, 18 May 2001 10:48:17 +0000
Subject: Re: display variable variables in a text field in a form
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-9427@lists.php.net to get a copy of this message
You know what? I did what you suggested and it works!. Overlooked that one alright. print " <tr $rowcolor>\n <td>$fieldn</td>\n <td><input type=\"text\" name=\"$values\" value=\"".$$values".\"></td>\n </tr>\n"; Yeah you're right, wonder why it works that way? Thanks anyway. regards Steve Brett wrote: > 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 > >

« previous php.db (#9427) next »