[PHP] Repopulating forms

2003-08-09 Thread Gerard L Petersen
Hi

My code looks like this.

?PHP
$test = gerard's name is \gerard\;
echo $test.br;
echo 'input type=text name=test2 value='.$test.'br';
?

form action=test2.php method=post
 input type=text name=foo value= /
 input type=submit name=sub value=submit

/form


When i run it the bit after the quotes are truncated. Where it truncates
depends on what type of quote i am using.

Any ideas?

Thanks

Gerard



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



Re: [PHP] Repopulating forms

2003-08-05 Thread Gerard L Petersen
Sweet...

Thank you. Works perfectly.

You all have be most helpful.

Hope this works in Smarty

Gerard

- Original Message - 
From: CPT John W. Holmes [EMAIL PROTECTED]
To: Gerard L Petersen [EMAIL PROTECTED]; Php-General
[EMAIL PROTECTED]
Sent: Tuesday, August 05, 2003 4:07 PM
Subject: Re: [PHP] Repopulating forms


 From: Gerard L Petersen [EMAIL PROTECTED]
  My code looks like this.
 
  ?PHP
  $test = gerard's name is \gerard\;
  echo $test.br;
  echo 'input type=text name=test2 value='.$test.'br';
  ?

 Just like HTML doesn't render newlines, it also doesn't understand using
the
 \ character as an escape character. You are creating this:

 input type=text name=test2 value=gerard's name is gerard

 So, HTML takes the first bit between double quotes and ignores the rest as
a
 unknown attribute.

 Run htmlentities() on $test before putting it in the INPUT element to
change
 the quotes to HTML entities.

 ---John Holmes...




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



RE: [PHP] Repopulating forms

2003-08-05 Thread Ford, Mike [LSS]
 -Original Message-
 From: Gerard L Petersen [mailto:[EMAIL PROTECTED]
 Sent: 05 August 2003 14:56
 
 My code looks like this.
 
 ?PHP
 $test = gerard's name is \gerard\;
 echo $test.br;
 echo 'input type=text name=test2 value='.$test.'br';

echo 'input type=text name=test2 value='.htmlentities($test).'br';

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



Re: [PHP] Repopulating forms

2003-08-05 Thread CPT John W. Holmes
From: Gerard L Petersen [EMAIL PROTECTED]
 My code looks like this.

 ?PHP
 $test = gerard's name is \gerard\;
 echo $test.br;
 echo 'input type=text name=test2 value='.$test.'br';
 ?

Just like HTML doesn't render newlines, it also doesn't understand using the
\ character as an escape character. You are creating this:

input type=text name=test2 value=gerard's name is gerard

So, HTML takes the first bit between double quotes and ignores the rest as a
unknown attribute.

Run htmlentities() on $test before putting it in the INPUT element to change
the quotes to HTML entities.

---John Holmes...


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