Edward Diener wrote:
I have a PHP file which does an:
echo "someresponse"
to return some data. When I run it from a Windows client program, the
response I am seeing is not only the "someresponse" above but also has
the entire HTML form in the PHP file appended to it.
Naturally I do not want the form to be included in the response and do
not understand how or why I am getting it back ? Does anybody know why
this is happening ?
As an example of what is happening my form data in the PHP file looks like:
<form ENCTYPE="multipart/form-data" ACTION="" METHOD="POST">
<input NAME="name1" TYPE="file">
<input NAME="name2" TYPE="text">
<input NAME="name3" TYPE="text">
<input VALUE="submit" TYPE="submit"></form>
Somewhere in the PHP file I am doing:
echo "someresponse"
and the data being read back in the response is a string of:
"someresponse\n<form ENCTYPE="multipart/form-data"
ACTION=""METHOD="POST">\n<input NAME="name1" TYPE="file">\n<input
NAME="name2" TYPE="text">\n<input NAME="name3" TYPE="text">\n<input
VALUE="submit" TYPE="submit"></form>"
My magical sight into your code reveals.... nothing.
Why? because I can't see it, I don't have any magical sight, so if you
don't post any code, I don't know what it is.
Now, usually this is simply a designflaw, eg. you have a script like so:
<?php
// do something
echo "someresponse";
// do something else
// do even more
echo '<form ENCTYPE="multipart/form-data"
ACTION=""METHOD="POST">\n<input NAME="name1" TYPE="file">\n<input
NAME="name2" TYPE="text">\n<input NAME="name3" TYPE="text">\n<input
VALUE="submit" TYPE="submit"></form>';
// do more stuff
?>
Probably your code further on doesn't check if you really want to show
it or not, there are 2 ways to resolve this:
1. exit after your response (using eg. die() or exit)
2. surround your form with an if() which checks that you really DO wish
to show it.
But, it might also be something else (though I doubt it), in which case:
Post your code, fool!! ([TM] mr. T)
- Tul
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php