Re: [PHP-DB] Data not fetching in the textfield.
Niel Archer napsal(a): Your variable value is not being inserted because you have used single quotes for the echo, not double quotes as the nabble example does. Special characters and variables are only interpreted in double quotes, they are treated literally in single quotes. -- Niel Archer Yes, also disabled field is not even sent input name=storename type=text maxlength=35 id=storename class=regForm *disabled=disabled* value=$rows[0] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Data not fetching in the textfield.
I am trying to fetch data through this code: My code: for($i=0;$imysql_num_rows($results);$i++) { $rows = mysql_fetch_array($results); echo 'div' ; echo 'div class=fieldrow' ; echo ' ' ; echo ' label for=storenameStore name:/label' ; echo ' ' ; echo ' input name=storename type=text maxlength=35 id=storename class=regForm disabled=disabled value=$rows[0]/input' ; echo '/div' ; The value option in the textfield is not fetching the data, neither is it throwing errors. However the same code works perfectly as suggested by one of expert Nabble users: Nabble code: for($i=0;$imysql_num_rows($results);$i++) { $rows = mysql_fetch_array($results); echo(input name=\input1\ type=\text\ value=$rows[0]); } Please help. Chris -- View this message in context: http://www.nabble.com/Data-not-fetching-in-the-textfield.-tf4523451.html#a12904665 Sent from the Php - Database mailing list archive at Nabble.com. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Data not fetching in the textfield.
Try replacing this: echo ' input name=storename type=text maxlength=35 id=storename class=regForm disabled=disabled value=$rows[0]/input' ; With this: echo ' input name=storename type=text maxlength=35 id=storename class=regForm disabled=disabled value='. $rows[0].'/input' ; -Original Message- From: Chris Carter [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 26, 2007 10:04 PM To: php-db@lists.php.net Subject: [PHP-DB] Data not fetching in the textfield. I am trying to fetch data through this code: My code: for($i=0;$imysql_num_rows($results);$i++) { $rows = mysql_fetch_array($results); echo 'div' ; echo 'div class=fieldrow' ; echo ' ' ; echo ' label for=storenameStore name:/label' ; echo ' ' ; echo ' input name=storename type=text maxlength=35 id=storename class=regForm disabled=disabled value=$rows[0]/input' ; echo '/div' ; The value option in the textfield is not fetching the data, neither is it throwing errors. However the same code works perfectly as suggested by one of expert Nabble users: Nabble code: for($i=0;$imysql_num_rows($results);$i++) { $rows = mysql_fetch_array($results); echo(input name=\input1\ type=\text\ value=$rows[0]); } Please help. Chris -- View this message in context: http://www.nabble.com/Data-not-fetching-in-the-textfield.-tf4523451.html#a1 2904665 Sent from the Php - Database mailing list archive at Nabble.com. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Data not fetching in the textfield.
Date: Wed, 26 Sep 2007 09:33:40 -0700 From: [EMAIL PROTECTED] echo(input name=\input1\ type=\text\ value=$rows[0]); If what you want rendered in html should have quotes like so: input name=input1 type=text value=some value Double quote the value like so: echo(input name=\input1\ type=\text\ value=\ . $rows[0] . \); and escape $rows[0] in case it contains any double quotes thusly (or with some other escape function): echo(input name=\input1\ type=\text\ value=\ . addcslashes($rows[0], '') . \); _ News, entertainment and everything you care about at Live.com. Get it now! http://www.live.com/getstarted.aspx
Re: [PHP-DB] Data not fetching in the textfield.
snip echo(input name=\input1\ type=\text\ value=$rows[0]); Change to echoinput name=\input1\ type=\text\ value=\ . htmlspecialchars($rows[0], ENT_QUOTES) . \; So html characters like and won't be interpreted by the browser. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Data not fetching in the textfield.
Your variable value is not being inserted because you have used single quotes for the echo, not double quotes as the nabble example does. Special characters and variables are only interpreted in double quotes, they are treated literally in single quotes. -- Niel Archer -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php