sprintf %s string /or " Why on earth do I only get ONE char displayed???"

From: Date: Thu, 16 Nov 2000 14:21:58 +0000
Subject: sprintf %s string /or " Why on earth do I only get ONE char displayed???"
Groups: php.general 
Request: Send a blank email to php-general+get-25693@lists.php.net to get a copy of this message
Yikes, being stuck with this one : Building a page where users will be able to change their details (the subscription page is done & is working fine...) After checking if the password/logon is correct & the user is defined as he has the rights to edit them, I want to get a table that would display the current/desired info in the DB & display them as EDITABLE fields... the request in Mysql works fine & I get something back on the page... only that "the 1st character" only is displayed where I need the FULL field to be displayed... (IE: I only get "A" instead of "Alain") here are the parts where I am stuck : <snip> #................. #Mysql querry here...... # CALLING THE FUNCTIONS ... print ("<TABLE>\n"); $row = mysql_fetch_array ($result); display_collumn ("Member ID", $row[id], 0); display_collumn ("Nom", $row[nom], 1); display_collumn ("Prenom", $row[prenom], 1); display_collumn ("Email", $row[email], 1); display_collumn ("Adresse", $row[adresse], 1); display_collumn ("Boite Postale", $row[cp], 1); display_collumn ("Ville", $row[ville], 1); display_collumn ("Pays",$row[pays], 1); display_collumn ("Jour", $row[naissDD], 1); display_collumn ("Mois", $row[naissMM], 1); display_collumn ("Annee", $row[naissYY], 1); print ("</TABLE>\n"); print ("<INPUT TYPE=\"submit\" NAME=\"clickonme\" VALUE=\"submit\">\n"); print "</FORM>\n"; } # OK, now here is the Function itself : # FONCTION DE DISPLAY DES COLLONNES function display_collumn ($label, $row, $editable) { print ("<TR>\n"); printf ("<TD>%s</TD>\n", htmlspecialchars ($label)); $value = htmlspecialchars ($row[$col_name]); if ($editable) #DISPLAY AS EDIT FIELDS { $str = sprintf ("<INPUT TYPE=text NAME=\"row[%s]\"", $col_name); $str .= sprintf (" VALUE=\"%s\" SIZE=\"50\">\n", $value); } else #DISPLAY AS READ ONLY $str = $value; printf ("<TD>%s</TD>\n", $str); print ("</TR>\n"); } Thx in advance, Al

« previous php.general (#25693) next »