[PHP] junk from my forms output
I have the following in a file called hello.php in my htdocs directory (Apache webroot). form action=action.php method=post pYour name: input type=text name=name //p pYour age: input type=text name=age //p pinput type=submit //p /form as well as the following in a file action.php, also in the same directory. Hi ?php echo htmlspecialchars($_POST['name']); ?. You are ?php echo (int)$_POST['age']; ? years old. When I click on the submit button of the form in hello.php, it should say something like: Hi Hanson. You are 33 years old. But instead of just saying that it also appends a bunch of junk at the beginning like this: {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Arial;}} {\*\generator Msftedit 5.41.21.2509;}\viewkind4\uc1\pard\f0\fs20 Hi hanson .\par You are 33 years old.\par } � Can someone help me with this? Why does my forms reply from action.php contain so much junk? I have a Windows installation of PHP and Apache. thanks, -Hanson
Re: [PHP] junk from my forms output
On 20/10/2011, at 10:24 AM, hanson zhou wrote: I have the following in a file called hello.php in my htdocs directory (Apache webroot). form action=action.php method=post pYour name: input type=text name=name //p pYour age: input type=text name=age //p pinput type=submit //p /form as well as the following in a file action.php, also in the same directory. Hi ?php echo htmlspecialchars($_POST['name']); ?. You are ?php echo (int)$_POST['age']; ? years old. When I click on the submit button of the form in hello.php, it should say something like: Hi Hanson. You are 33 years old. But instead of just saying that it also appends a bunch of junk at the beginning like this: {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Arial;}} {\*\generator Msftedit 5.41.21.2509;}\viewkind4\uc1\pard\f0\fs20 Hi hanson .\par You are 33 years old.\par } � Can someone help me with this? Why does my forms reply from action.php contain so much junk? I have a Windows installation of PHP and Apache. thanks, -Hanson You saved action.php as a RTF file rather than a plain text file. Resave it as a plain text file. --- Simon Welsh Admin of http://simon.geek.nz/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: [PHP] junk from my forms output
On 19 Oct 2011 at 22:27, Simon J Welsh si...@welsh.co.nz wrote: On 20/10/2011, at 10:24 AM, hanson zhou wrote: I have the following in a file called hello.php in my htdocs directory (Apache webroot). form action=action.php method=post pYour name: input type=text name=name //p pYour age: input type=text name=age //p pinput type=submit //p /form as well as the following in a file action.php, also in the same directory. Hi ?php echo htmlspecialchars($_POST['name']); ?. You are ?php echo (int)$_POST['age']; ? years old. When I click on the submit button of the form in hello.php, it should say something like: Hi Hanson. You are 33 years old. But instead of just saying that it also appends a bunch of junk at the beginning like this: {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Arial;}} {\*\generator Msftedit 5.41.21.2509;}\viewkind4\uc1\pard\f0\fs20 Hi hanson .\par You are 33 years old.\par } � Can someone help me with this? Why does my forms reply from action.php contain so much junk? I have a Windows installation of PHP and Apache. You saved action.php as a RTF file rather than a plain text file. Resave it as a plain text file. Sounds like you should also use a text editor rather that Word or similar for editing your program files. Use Notepad or whatever they have or Windows machines. -- Cheers -- Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php