[PHP-DB] displaying info in a form

2002-03-29 Thread Natividad Castro

Hi to all,
I'm trying to display data in a form, but for some reason I can display the
entire value of every field that has more than two words in the text box.
For example, if I want to display the name CASTRO TRUCKING, the text field
only display the first word CASTRO.

I tried to use the trim() function, but it didn't work.

Any idea?

Thanks in advanced.
Nato

here is the code

html
body
?php
include ./connection.php;
//include ./common_db.inc;
//$link_id = db_connect('test_bia');

$result = mysql_query(SELECT * FROM test LIMIT 0, 1);

//while($query_data = mysql_fetch_array($result)) {

echoform;
while($query_data = mysql_fetch_array($result)){



  $tracking_num = $query_data[0];

  $id = $query_data[1];

  $name = $query_data[2];

  $user = $query_data[3];

  $comment = $query_data[4];
}
?
table border=1
form name=test action=test.php method=post
tr
tdinput type=text value=?php echo $tracking_num ?
/td
tdinput type=text value=?php echo $id ?
/td
tdinput type=text value=?php echo $name ?
/td
tdinput type=text value=?php echo $user ?
/td
/tr
tdinput type=text name=comment value=?php echo $comment ?
tr
tdbrbr
input type=submit value=Send
/td/tr
/form
/td/tr/table
/body
/html


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] displaying info in a form

2002-03-29 Thread biorn

I have come across this before.  Make sure you put  around the value field 
and then single quotes around the variable, ie.

tdinput type=text value=?php echo '$tracking_num' ?
 /td
 tdinput type=text value=?php echo '$id' ? (NOTE: if this is an int 
value, you do not need to use the single quotes around $id)
 /td
 tdinput type=text value=?php echo '$name' ?
 /td
 tdinput type=text value=?php echo '$user' ?
 /td
 /tr
 tdinput type=text name=comment value=?php echo '$comment' ?


HTH

MB

Natividad Castro [EMAIL PROTECTED] said:

 Hi to all,
 I'm trying to display data in a form, but for some reason I can display the
 entire value of every field that has more than two words in the text box.
 For example, if I want to display the name CASTRO TRUCKING, the text field
 only display the first word CASTRO.
 
 I tried to use the trim() function, but it didn't work.
 
 Any idea?
 
 Thanks in advanced.
 Nato
 
 here is the code
 
 html
 body
 ?php
 include ./connection.php;
 //include ./common_db.inc;
 //$link_id = db_connect('test_bia');
 
 $result = mysql_query(SELECT * FROM test LIMIT 0, 1);
 
 //while($query_data = mysql_fetch_array($result)) {
 
 echoform;
 while($query_data = mysql_fetch_array($result)){
 
 
 
   $tracking_num = $query_data[0];
 
   $id = $query_data[1];
 
   $name = $query_data[2];
 
   $user = $query_data[3];
 
   $comment = $query_data[4];
 }
 ?
 table border=1
 form name=test action=test.php method=post
 tr
 tdinput type=text value=?php echo $tracking_num ?
 /td
 tdinput type=text value=?php echo $id ?
 /td
 tdinput type=text value=?php echo $name ?
 /td
 tdinput type=text value=?php echo $user ?
 /td
 /tr
 tdinput type=text name=comment value=?php echo $comment ?
 tr
 tdbrbr
 input type=submit value=Send
 /td/tr
 /form
 /td/tr/table
 /body
 /html
 
 
 -- 
 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] displaying info in a form

2002-03-29 Thread Paul Burney

on 3/29/02 10:54 AM, Natividad Castro at [EMAIL PROTECTED] appended the
following bits to my mbox:

 I'm trying to display data in a form, but for some reason I can display the
 entire value of every field that has more than two words in the text box.
 For example, if I want to display the name CASTRO TRUCKING, the text field
 only display the first word CASTRO.

 tdinput type=text value=?php echo $name ?

Just following up on what someone else said.  If the Name field has a quote
in it, such as Joe's Amazing Truck Company that could also cause
problems.  

To remedy, do this:

input type=text value=?php echo htmlspecialchars($name); ?

HTH,

Paul Burney
http://burney.ws/

?php
while ($self != asleep) {
$sheep_count++;
}
?



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php